Boost logo

Boost :

Subject: Re: [boost] [units] c++11 features to speed up compilation times
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-03-19 14:36:56


Le 19/03/13 13:44, Oliver Esser a écrit :
> Hi,
>
> I was wondering if there was a policy for boost including C++11
> features into the libraries. Obviously there might be many projects
> out there that do not (yet) have access to a compiler implementing the
> new standard or choosing not to use such a compiler.
>
> Anyways I was looking for a dimensional analysis library for compile
> time units checking and found Boost.Units to be quite slow at compile
> time even for the relatively small example code in the quickstart
> documentation. So I've written a bit of code that follows the approach
> of Boost.Units but uses C++11 features (constexpr, variadic templates,
> suffix operator, auto). It is not a complete library that I would use
> in a production environment, but it looks promising, since compilation
> times are about a factor 2-3 faster on my machine. It would be great
> if some of you could take a look.
>
> https://github.com/legento/units
>
> Maybe one could add an implementation like that to Boost.Units as a
> C++11 compiler detected feature to speed things up. Maybe I am totally
> wrong and it is some coincidence that this compiles faster on my
> platform. I did just minimalistic 'ok it seems to work' testing and
> was about as thorough with measurements. So see this as an
> implementation sketch.
I'm sure that the Unit author will accept patches going forward a C++11
implementation. I suggest you to prepare a patch to introduce constexpr
and another to variadic templates separately and see how this improves
the compilation time. Even if the compilation time is not improved
substantially these should improve the library however.

Concerning suffix operator, this is a new and desirable feature by
itself that needs a little bit more discussion.

Of course, the patches should include also documentation and test updates.

Best,
Vicente


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