Boost logo

Boost Users :

From: Daniel Krügler (dsp_at_[hidden])
Date: 2006-11-27 02:42:18


chun ping wang wrote:
> Hmm now i run into another problem.. probably more so to do with c++
> language.
> template <class T>
> class AES
> {
> private:
> static const boost::array<T, 30> Rcon =
> {
> 0x01, 0x02, 0x04, 0x08,
> 0x10, 0x20, 0x40, 0x80,
> 0x1b, 0x36, 0x6c, 0xd8,
> 0xab, 0x4d, 0x9a, 0x2f,
> 0x5e, 0xbc, 0x63, 0xc6,
> 0x97, 0x35, 0x6a, 0xd4,
> 0xb3, 0x7d, 0xfa, 0xef,
> 0xc5, 0x91
> };
>
> };
>
> // 19 C:\CPW\cs classes\cs512\c++\AES.hpp a brace-enclosed initializer
> is not allowed here before '{' token

The compiler is right. Try something like this:

template <class T>
class AES
{
    private:
static const boost::array<T, 30> Rcon;

};

template <typename T>
const boost::array<T, 30> AES<T>::Rcon =
            {
                 0x01, 0x02, 0x04, 0x08,
     0x10, 0x20, 0x40, 0x80,
     0x1b, 0x36, 0x6c, 0xd8,
     0xab, 0x4d, 0x9a, 0x2f,
     0x5e, 0xbc, 0x63, 0xc6,
     0x97, 0x35, 0x6a, 0xd4,
     0xb3, 0x7d, 0xfa, 0xef,
     0xc5, 0x91
            };

Greetings from Bremen,

Daniel Krügler


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net