Boost logo

Boost :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-02-03 10:00:06


Thorsten Ottosen wrote:
> Shunsuke Sogame wrote:
>
>>Thorsten Ottosen wrote:
>
>
>>>>I'm maybe an worrier, struggling with ADL invasions.
>>>>But short names conflict.
>>>
>>>
>>>true, that is why begin()/end() were abadened.
>>
>>
>>I maybe failed persuasion. :-)
>>But "mathematically", I believe ADL customization
>>must be full name that emulates namespace.
>>
>>Well, I request tag-dispatching customization using
>>class template partial specialization to next Boost.Ranges.
>>Now that I really need tag-dispatching, I'm against ADL customization.
>>I recall you said something like that. You were right.
>>My current ATL/WTL CString range implementation code is horror.
>>Will you add it to TODO list of next Boost.Ranges!
>
>
> Can you elaborate on what exactly you would like to see?

For instance, ATL/WTL have four strings.
They have the same interfaces.
I want to share the implementation.
You may say "Forward them to one implementation function", but:

   template< class BaseT, class TraitsT > inline
   typename boost::range_iterator< CStringT<BaseT, TraitsT> >::type
   boost_range_begin(CStringT<BaseT, TraitsT>& str)
   {
     return str.GetBuffer(0);
   }

   template< class BaseT, class TraitsT > inline
   typename boost::range_const_iterator< CStringT<BaseT, TraitsT> >::type
   boost_range_begin(const CStringT<BaseT, TraitsT>& str)
   {
     return str.GetString();
   }

Even forwarding is horror.
Moreover, the different version of ATL has different template parameters.

I found Boost.Sequence draft by Mr.Abrahams one week ago:
   http://boost-consulting.com/projects/mtl4/libs/sequence/doc/html/
   http://boost-consulting.com/projects/mtl4/libs/sequence/doc/html/intrinsics.html

   #include <vector>

   struct vector_tag { };

   namespace poost { namespace customization {

       template< class ValueT >
       struct tag< std::vector<ValueT> >
       {
           typedef ::vector_tag type;
       };

       template< class VectorT >
       struct operations< VectorT, ::vector_tag >
       {
           struct begin
           {
               typedef typename VectorT::iterator type;

               type operator()(VectorT& vec) const
               {
                   return vec.begin();
               }
           };

           struct end
           {
               typedef typename VectorT::iterator type;

               type operator()(VectorT& vec) const
               {
                   return vec.end();
               }
           };
       };

   } } // namespace poost::customization

It is impressive to me.

Regards,
Shunsuke Sogame


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