Boost logo

Boost :

Subject: Re: [boost] Holding char arrays in boost variants, what is the correct way?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-06-14 12:10:15

On 14/06/2011 17:23, Michael Goldshteyn wrote:
> What is the correct way of getting several character arrays into a variant:
> // This doesn't work
> typedef boost::variant<int,char[256],char[8192]> MyType;
> // This does, but seems like a lot of work
> template <int len>
> struct MyChar
> {
> char val_[len];
> };

Use boost::array (or std::array if you have it).

Boost list run by bdawes at, gregod at, cpdaniel at, john at