|
Boost : |
From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2002-10-30 11:12:47
Peter Dimov wrote:
> From: "George A. Heintzelman" <georgeh_at_[hidden]>
> > > std::vector< boost::shared_ptr<int> > v;
> > > type(v.begin());
> > >
> > > Will this work? Nobody knows.
> >
> > Because it depends on whether the iterator is a separate class or a
> > pointer.
>
> Not only that; even when the iterator is a separate class, boost may still
> be an associated namespace.
Yes, I see that that is possible. In fact now that I think about it, I
don't think I can come up with an implementation of std::vector where
boost would not be an associated namespace for this example. Since the
dereference of the iterator is required to have the type of
boost::shared_ptr<int> &, I think it has to either be a pointer or a
type which is (directly or indirectly) templatized on it.
> Suppose that you have
>
> template<class It> ... type(It it);
>
> visible, to catch the general case, and do something sensible by default,
> while still relying on ADL for specialized 'type' definitions for some
> iterator types. Now boost::type<> may break the code.
But this case would be broken even without any of the specialized ADL
functions being around, wouldn't it? I agree that it can definitely be
a problem when defining generic non-member functions to be used on
classes in other big namespaces, and the issue probably should be
thought about. Of course, core issue 218 would fix this in this case as
well, but it wouldn't if boost::type were also a function. I don't have
any other insights about this, though.
George Heintzelman
georgeh_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk