Boost logo

Boost :

Subject: Re: [boost] [serialization] Proposal: make 'version' trait (and others)enable_if-friendly
From: Gabriel Redner (gredner_at_[hidden])
Date: 2012-12-06 14:17:49


Hi Robert,

Thanks for taking a look, and for developing the library!

> Hmm - doesn't the fillowing work? - for each T used
>
> template <>
> struct version<Foo<t>::MyType>{
> BOOST_STATIC_CONSTANT(unsigned int, value = 1);
> };
>
> I understand it might be a little more tedious and not that clever
> but it's much, much, much less time consuming to understand, documment,
> explain
> and support. Your suggestion is clever - but I just don't think it's
> cost effective.

Technically - yes, I could probably enumerate all types. However, my
example is severely simplified and in reality the 'Foo'-equivalent has
several template parameters. Enumerating all of the combinations
would create its own maintenance nightmare and essentially defeat the
benefits of templating.

I don't mean to dismiss your suggestion, but I think you are looking
at things from the wrong perspective. Your objection seems not to be
with the proposed library change, but with how I am going to use it.
>From the library's point of view, this is a change that increases
flexibility while leaving existing use-cases untouched. Since this
pattern is common in other boost libraries, I would say there is a
clear need for it as well as precedent. If a user doesn't need the
added flexibility, they can ignore the extra parameter. But, if a
user *does* need it, it's a lifesaver.

Thanks,
-Gabe


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