Boost logo

Boost Users :

From: Tom Matelich (tmatelich_at_[hidden])
Date: 2002-08-28 11:22:51


It appears that an enum cannot be default constructed in the way that tuple
does,
cons() : head(), tail() {}

Any idea on how to get around this (besides using an int in the tuple)?

Thanks,
Tom

<sample_code>

#include <boost/tuple/tuple.hpp>
#include <string>

enum Foo { Willis, Arnold };

void test()
{
        boost::tuple<Foo, std::string> a;
}

</sample_code>

</error compiler="gcc version 2.96 20000731 (Mandrake Linux 8.2)">

/usr/local/eddynet/opt/include/boost/tuple/detail/tuple_basic.hpp: In method
`boost::tuples::cons<HT,
TT>::cons () [with HT = Foo, TT = boost::tuples::cons<string,
boost::tuples::null_type>]':
/usr/local/eddynet/opt/include/boost/tuple/detail/tuple_basic.hpp:454:
instantiated from `boost::tuples::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8,
T9>::tuple () [with T0 = Foo, T1 = string, T2 = boost::tuples::null_type, T3
= boost::tuples::null_type, T4 = boost::tuples::null_type, T5 =
boost::tuples::null_type, T6 = boost::tuples::null_type, T7 =
boost::tuples::null_type, T8 = boost::tuples::null_type, T9 =
boost::tuples::null_type]'
tuple_enum_test.cpp:8: instantiated from here
/usr/local/eddynet/opt/include/boost/tuple/detail/tuple_basic.hpp:263:
cannot convert `int' to `Foo' in
assignment

</error>

-----------------------------------------------------------------------
DISCLAIMER: Information contained in this message and/or
attachment(s) may contain confidential information of Zetec, Inc.
If you have received this transmission in error, please notify
the sender by return email.
-----------------------------------------------------------------------


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