Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2004-09-15 08:00:10


"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.

Regards,
Arkadiy


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