|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2006-02-14 07:55:26
Paul Joseph Panaro <pjpanaro_at_[hidden]> writes:
> #include <boost/variant.hpp>
> #include <boost/multi_array.hpp>
>
> typedef boost::variant< double, std::string > Variant_t;
> typedef boost::multi_array<Variant_t, 2> Array2d_t;
> typedef boost::multi_array<Variant_t, 1> Array1d_t;
>
> // not sure if this is even legal
> int main ()
> {
> Array2d_t A(boost::extents[3][4]);
>
> for(Array2d_t::iterator i = A.begin(); i != A.end(); ++i)
> for(Array1d_t::iterator j = i->begin(); j != i->end(); ++j)
> *j=Variant_t(1.1);
>
> return 0;
> }
>
> boost 1.31.1
> and multi_array for variants
>
> for g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-42):
> No Errors
>
> g++ (GCC) 3.4.3 20050227 (Red Hat 3.4.3-22.1)
I just compiled your program with Cygwin G++ 3.4.4 using the Boost
CVS. I suggest first upgrading your compiler and then, if that
doesn't work, your Boost.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk