|
Boost : |
From: Paul Joseph Panaro (pjpanaro_at_[hidden])
Date: 2006-02-13 19:12:52
#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)
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:
In function `typename boost::detail::enable_if_interoperable<Derived1,
Derived2, typename boost::mpl::apply2<boost::detail::always_bool2,
Derived1,
Derived2>::type>::type boost::operator!=(const
boost::iterator_facade<Derived1, V1, TC1, R1, D1>&, const
boost::iterator_facade<Derived2, V2, TC2, R2, D2>&) [with Derived1 =
boost::detail::multi_array::array_iterator<Variant_t, Variant_t*,
mpl_::size_t<2u>, boost::detail::multi_array::sub_array<Variant_t, 1u> >,
V1 =
boost::multi_array<Variant_t, 1u, std::allocator<Variant_t> >, TC1 =
boost::random_access_traversal_tag, R1 =
boost::detail::multi_array::sub_array<Variant_t, 1u>, D1 = ptrdiff_t,
Derived2
= boost::detail::multi_array::array_iterator<Variant_t, Variant_t*,
mpl_::size_t<2u>, boost::detail::multi_array::sub_array<Variant_t, 1u> >,
V2 =
boost::multi_array<Variant_t, 1u, std::allocator<Variant_t> >, TC2 =
boost::random_access_traversal_tag, R2 =
boost::detail::multi_array::sub_array<Variant_t, 1u>, D2 = ptrdiff_t]':
multi.cc:12: instantiated from here
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:840:
error: dependent-name ` boost::is_convertible<Derived2,Derived1>::type'
is
parsed as a non-type, but instantiation yields a type
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:840:
note: say `typename boost::is_convertible<Derived2,Derived1>::type' if a
type
is meant
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:
In function `typename boost::detail::enable_if_interoperable<Derived1,
Derived2, typename boost::mpl::apply2<boost::detail::always_bool2,
Derived1,
Derived2>::type>::type boost::operator!=(const
boost::iterator_facade<Derived1, V1, TC1, R1, D1>&, const
boost::iterator_facade<Derived2, V2, TC2, R2, D2>&) [with Derived1 =
boost::detail::multi_array::array_iterator<Variant_t, Variant_t*,
mpl_::size_t<1u>, Variant_t&>, V1 = Variant_t, TC1 =
boost::random_access_traversal_tag, R1 = Variant_t&, D1 = ptrdiff_t,
Derived2
= boost::detail::multi_array::array_iterator<Variant_t, Variant_t*,
mpl_::size_t<1u>, Variant_t&>, V2 = Variant_t, TC2 =
boost::random_access_traversal_tag, R2 = Variant_t&, D2 = ptrdiff_t]':
multi.cc:13: instantiated from here
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:840:
error: dependent-name ` boost::is_convertible<Derived2,Derived1>::type'
is
parsed as a non-type, but instantiation yields a type
/local/boost/1.33.1/common/include/boost-1_33_1/boost/iterator/iterator_facade.hpp:840:
note: say `typename boost::is_convertible<Derived2,Derived1>::type' if a
type
is meant
make: *** [multi] Error 1
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk