Boost logo

Boost :

From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-09-16 02:02:23


On Wed, 15 Sep 2004 09:00:10 -0400, Arkadiy Vertleyb
<vertleyb_at_[hidden]> wrote:
> "Peder Holt" <peder.holt_at_[hidden]> wrote
> > On Tue, 14 Sep 2004 09:31:59 -0400, Arkadiy Vertleyb
>
>
> > <vertleyb_at_[hidden]> wrote:
> > > I actually don't think they are VERY similar. We would write more code
> > > trying to fit them together, then both of them already have. This is a
> > > matter of taste, of course, but I am against reuse in such cases. This
> > > would just put more fog on things that are not that easy to understand
> in
> > > the first place.
> > >
> > I don't agree. Consider the following code:
> >
> > #ifdef BOOST_NO_PARTIAL_TEMPLATE_SPECIALIZATION
> > #define DECODE_TYPE_IMPL_BEGIN(name,Iter)\
> > template<>\
> > struct decode_type_impl<CONST_ID>{\
> > template<typename Iter>\
> > struct decoder {
> >
> > #define DECODE_TYPE_IMPL_END() };};
> > #define DECODE_TYPE(Iter)\
> > typename decode_impl<Iter::value>::decoder<BOOST_DEDUCED_TYPENAME
> Iter::next>
> >
> > #else
> >
> > #define DEDOCE_TYPE_IMPL_BEGIN(name,Iter)\
> > template<typename Iter>
> > struct decode_type_impl<mpl::int_<name>,Iter>{
> >
> > #define DECODE_TYPE_IMPL_END() };
> > #define DECODE_TYPE(Iter) decode_type<Iter>
> >
> > #end
> >
> > This would allow us to create a unified decode implementation:
> >
> > DECODE_TYPE_IMPL_BEGIN(CONST_ID)
> > typedef DECODE_TYPE(Iter) d1;
> > typedef typename d1::type const type;
> > typedef typename d1::iter iter;
> > DECODE_TYPE_IMPL_END()
> >
> > DECODE_TYPE_IMPL_BEGIN(PTR_ID)
> > typedef DECODE_TYPE(Iter) d1;
> > typedef typename d1::type* type;
> > typedef typename d1::iter iter;
> > DECODE_TYPE_IMPL_END()
> >
> > I think this is at least worth consideration.
>
> A matter of taste, as I said. I don't think the above code buys us much in
> terms of reuse (the amount of code is apprximately the same, if not more),
> but it definitely complicates understanding of things...
>
> I would prefer a more light-weight integration, where some utilities can be
> shared, of course, such as integral encoding, unique ID generation, etc.
> However, trying to totaly blend systems together would IMO be harmful for
> both of them, considering major differences inevitably imposed by different
> techniques allowed by the target compilers.
>

Ok.
What remains then is to decide which of the two template registration
schemes should be used:
REGISTER_TEMPLATE(type,2,(typename,int)) or
REGISTER_TEMPLATE(type,(typename)(int))

--
Peder Holt
> 
> 
> Regards,
> Arkadiy
> 
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

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