Boost logo

Boost :

From: Adam Badura (abadura_at_[hidden])
Date: 2005-09-25 07:39:38


    As I rewrite some parts of code for color library I noticed silent
assumption I made. Namely I assumed that all color components are the same
type. But must it be this way?
    Does anyone use types like:

struct rgb {
    float r;
    unsigned char b;
    signed char g;
};

    I think adding such a feature (enabling use of such components) will not
be hard, but it will make code a littl longer (but as fast in execution) and
harder to maintain. Also writing own component class would be a little bit
longer (for those who use all components of the same type). However I plann
to make ready implementations for common component models.
    I know thet soem types can be simulated by others. For example:

struct rgb {
    usnigned int r : 16;
    unsigned int b : 8;
    unsigned int g : 8;
};

all components have here the same type even if "r" and "g" could really use
"unsigned char". But when there is difference signed/usnigned or
integer/float nothing (as I think) can be done.

    So? Allow diffrent types or not?

    Adam Badura


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