Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-10-23 06:48:53


Hello,

in the file mem_algo_common.hpp there is a class
basic_multiallocation_iterator (line 50ff).

This class contains both definitions for operator* and operator->, where
operator* is implemented as:

    value_type operator*() const
    {
       value_type v = (char*)detail::get_pointer(next_alloc_.next_);
       return v;
    }

and operator->() as:

    pointer operator->() const
    { return &operator*(); }

The second definition confuses both me and my compiler. Does &operator*()
actually mean &(*this)? If yes, wouldn't this mean that operator-> returns
the address of a stack allocated result variable, namely the address of the
result of operator*? If no, what does this actually mean?

Thanks for enlightening me,
Markus


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk