Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2006-05-23 12:19:21


David Gruener wrote:
>>>Thorsten Ottosen wrote:
>>>
>>>BOOST_ITER_FOREACH( i, get_range() )
>>>{
>>> std::cout << *i;
>>>}
>
>
> Eric Niebler wrote:
>
>>It's not implementable in standard C++, unless you know something I don't.
>
>
> Hello Eric,
> can you provide some hints why this is not possible?
> For example, can't we use some (boost::?)typeof logic
> to fetch the iterators type? ;-)

Even if you were willing to accept that, in order to use this macro, you
may have to register types with BOOST_TYPEOF (an interface I'm not
overly fond of), there are still problems. Registering types for
iterators is notoriously difficult. How would you write the BOOST_TYPEOF
registrations for the std::vector iterators, for instance, considering
that they could very well be defined as:

namespace std {
   template<class T, class Al>
   struct vector {
     struct iterator {
        //...
     };
   };
}

// register std::vector<T,Al>::iterator
BOOST_TYPEOF_REGISTER_TYPE(?????)

Has anyone solved this problem?

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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