|
Boost Users : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-03 19:07:53
Thorsten Ottosen wrote:
> "Arkadiy Vertleyb" <vertleyb_at_[hidden]> wrote in message
>> I am not really that familiar with this library, but I assume it has
>> to do with containers, correct? Assume the following usage
>> (pseudocode)
>>
>> Range(std::vector<MyNamespace::SomeTemplate<boost::multi-index<boost::mpl::v
>> ector> > > )
>>
>> Now ADL will use std, boost, MyNamespace, boost::multi_index, and
>> boost::mpl to find Range. There is absolutely no guarantee that it
>> won't find conflicting functions :-(
>
> I don't get this. Surely one of the functions would be a better match
> than the others and hence called.
I think Arkadiy might mean that the wrong function could be selected; however,
the class author should be able to figure this out.
Would it be possible to indroduce an extra level of indirection so that Range
can be used with a type even if there are preexisting begin/end/.. functions
that do the wrong thing? For instance,
template<typename T>
struct begin_impl {
typename range_iterator<T>::type
begin( T& c ) { return adl_begin(c); }
typename range_const_iterator<T>::type
begin( const T& c ) { return adl_begin(c); }
};
template< class T >
typename range_iterator<T>::type
begin( T& c )
{
return begin_impl<T>::begin(c);
}
template< class T >
typename range_const_iterator<T>::type
begin( const T& c )
{
return begin_impl<T>::begin(c);
}
Then as a last resort someone could specialize begin_impl. Or is something like
this already possible?
Jonathan
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net