Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-06-21 13:35:53


I often find it usefull to be able to access the array size at
compile-time, even when the array is coming in as a plain template
argument. Therefore it would be nice to have an enum that provides
public access to N.

    template<class T, std::size_t N>
    class array {
      public:
        enum { SIZE = N };

        ...
    };

Note, this can also be done with a static const int... but there are
some comiler (VC++) portability issues.

Cheers,

Jeremy


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