c – 花式指针是什么样的?

C参考文献提到了一个名为 fancy pointers的概念.我从最近一次严重的投票和后来删除的问题中了解到了它们的存在.

这个定义模糊不清:

When the member type pointer is not a raw pointer type,it is commonly referred to as a “fancy pointer”.

他们的用例示例如下:

An example of a fancy pointer is the mapping address-independent
pointer boost::interprocess::offset_ptr,which makes it possible to
allocate node-based data structures such as std::set in shared memory
and memory mapped files mapped in different addresses in every
process. Fancy pointers can be used independently of the allocator
that provided them,through the class template std::pointer_traits.

我不明白这个解释.创建花式指针的语法是什么?为什么我不能在这种情况下使用常规指针?

解决方法

花哨的指针只是一个像指针一样但不是指针的术语.以一个迭代器为例.几乎所有迭代器都是自定义类类型,但它们的行为就像一个指针(有时会有一些限制,你不能完成指针支持的所有操作,因为它们不提供随机访问,但这是一种幻想的一部分.)

换句话说:一个像指针一样的抽象是一个奇特的指针.

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...