Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2004-04-14 08:10:34


Hi Robert,

This is some comments based on reading the tutorial. I think your
explanations are
fine, but I would like to see some remarks added:

eg

class gps_position
{
public:
    int degrees;
    int minutes;
    float seconds;
    gps_position(){};
    gps_position(int d, int m, float s) :
        degrees(d), minutes(m), seconds(s)
    {}
};

I think it should be stated that this is not recommended practice, ie, this
class has a non-trivial invariant
and should not have public members. A better example might be to use
std::pair.

The examples use pointers in arrays and pointers in standard containers. I
think the text should
state that this is not recommended; or even better, throw in a shared_ptr
instead. The code in the
example is inherently exception unsafe.

Therefore I also think that container< shared_ptr<T> > should be supported
by default whereas container< T* >
is, well, ok if you don't have exceptions somehow.

br

Thorsten


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