
Thorsten Ottosen wrote:
Shunsuke Sogame wrote:
Thorsten Ottosen wrote:
Can you elaborate on what exactly you would like to see?
Moreover, the different version of ATL has different template parameters.
if ATL actually uses a namespace, you could add a unconstrained overload of range_begin/range_end.
ATL/WTL has also many containers that can conform to Boost.Range. I request tag-dispatching!
How will a different mechanism save you from provding specializations of alle the types you want to support?
I tried to write Boost.Range implementation of ATL/WTL collections. But I gave up. There are 13 classes. They form a simple hierarchy, but we cannot take advantage of it. Partial class template specialization ignores base/derived relationship. And "primary" range_detail::boost_range_begin(C&) eats all the derived classes. Thus, I have to write 13 implementations. Now I see ADL customization way is blob. Type itself has another job, that is, implementation selector. Left the job to tag... For example, std::pair range implementation could be simplified to something like: namespace customization { namespace std_pair_detail { struct tag { }; } // namespace std_pair_detail template< class T > struct tag< std::pair<T, T> > : boost::mpl::identity<std_pair_detail::tag> { }; template< class PairT > struct metafunctions<PairT, std_pair_detail::tag> { typedef typename PairT::first_type iterator; typedef iterator const_iterator; }; template< > struct functions<std_pair_detail::tag> { template< class PairT > typename boost::range_iterator<PairT>::type begin(PairT& p) { return p.first; } template< class PairT > typename boost::range_iterator<PairT>::type end(PairT& p) { return p.second; } }; } Now 'PairT' is almost concept. A type derived from std::pair<> specializes only tag<>. Moreover, 'const' overloads disappear. (though such overloads also are possible.) Of course, default implementation can call 'boost_range_begin'. Compatibility holds. I said range metafunctions were "public virtual interfaces". IMHO, next version should make them non-virtual. By doing this, you can contrive any nice customization way anytime. -- Regards, Shunsuke Sogame