Boost logo

Boost :

From: Maciej Sobczak (maciej_at_[hidden])
Date: 2002-06-26 03:16:21


Hi Boosters,

In one of my projects I would like to use some utility to measure
elapsed time for simple performance estimations. class timer is really
straightforward and it is something that I usually rolled on my own.
Today, to be trendy (;-)), I would like to just #include
"boost/timer.hpp" in my project. The compilers I use can eat this file
with a yawn, so I think it is enough to add the timer.hpp file to my
project (leaving the copyright stuff intact, of course), put appropriate
#include in my code and happily distribute the whole project.

No, no, no...

The timer.hpp #includes config.hpp and limits.hpp, which...
Again - my compilers can eat the class timer without problems and I do
not expect porting soon to some esoteric or more broken compilers.

1. Including the whole config/details/limits hierarchy in my little
project is not justified (it would be bigger than the project itself).
2. Asking my users to download the whole Boost so that I can use one
little simple timer class is not justified.
3. Writing code like:

#define BOOST_NO_USER_CONFIG
#define BOOST_NO_CONFIG
#define BOOST_NO_whatever_else_to_cut_the_includes
#define BOOST_NO_...
// and finally:
#include "timer.hpp"

is not justified (or is it?).

I understand the need for all those configs/details/limits and so on,
but portability to everything is not my concern here and my project is
supposed to be as simple as possible.

A question to you, Boosters, is: Should I roll my own 10-lines timer
class (it is a challenging question, I know ;-))?

The same question could be asked about any other small class in Boost:
how to pick some really small thing from Boost without inducing the
chain of includes?

The other possiblity is to take the timer.hpp file and *change* it
deliberately, writing few lines of comment around.

What do you think?
What do you do?
Is it considered a problem?
Would it be justified to make some minimal version of Boost (or at least
some part of it) for decent compilers? (kidding)

I know that once the whole Boost gets included in C++0x (:-)), the
problem will vanish - today nobody cares about the dependencies between
standard headers - but at the moment it bothers me a bit.

Regards,

Maciej Sobczak
http://www.maciejsobczak.com/


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