Boost logo

Boost :

Subject: Re: [boost] [review][constrained_value] ReviewofConstrainedValueLibrary begins today
From: Chris (indy271828_at_[hidden])
Date: 2008-12-07 13:00:45


My simple review:

I spent two hours, read the document once. Looked at constrained.hpp
once. The code is well documented, I don't have any technical concerns
at first glance. I would like DEBUG sorted out though. Would I
typedef all the bounded types? I am not sure, I would rather have an
option to disable it using a macro as well.

I tried to compile a test program using gcc 4.4 and linux, but I don't
have utility/swap.hpp so I gave up.
I assume this in a boost beta/sandbox somewhere.

Here are my ideas:

In my own code, I already have a class called cyclic_iterator that uses
the boost iterator facade.
It does the same thing as this wrapping iterator does.
I have a class called defaulted<typename T, T value>, that will default
initialize a value so I don't forget to do it in the constructor.
This library reminds me of that. You can combine it if you want. :) Or
add something like this:
class A {

A() { // fails
}

must_initialize<int> t;
};

In OpenGL, they use GLenum for enums, but have a list of #defines with
ints, so there is no type checking. I can see when this bounded class
would be useful. Checking GL_FROM GL_TO.

Constant expression checks:
If boost eventually uses c++0x, I'm sure you could do a static_assert
with constexpr overloading and have many compile time checks.

I definitely think "wrapping iterator" needs to be in boost somewhere,
and before I made cyclic_iterator I was surprised it wasn't.
wrapping_int is useful.

I like effort put into this project, thank you Robert.

Overall I would accept it, it's simple and lightweight. Can't be too
harmful.

Chris


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