Subj : Re: Reference , pointer , constant pointer or what ?? To : borland.public.cpp.borlandcpp From : maeder Date : Tue Feb 22 2005 06:29 pm "David Currie" writes: > Is there pointer to a SINGLE object(No Incr,Decr) available in C++. If so > what is it. Not out of the box, now. What you can do is define your own type that mimics a built-in pointer type except pointer arithmetics. Something like template class MyDecentPointerType { public: MyDecentPointerType(); explicit MyDecentPointerType(T *); T &operator*() const; T *operator->() const; T *get() const; private: T *myReferred; }; You might be tempted to also offer implicit conversion from MyDecentPointerType to T *, but there are problems to implicit conversions severe enough that many people prefer to err on the safe side. This is also why I declared the second constructor explicit. Of course, you can still construct a MyDecentPointerType object around a pointer to an array element; but once you have a MyDecentPointerType, it's hard to inadvertently treat it like a pointer into an array. .