1 // scoped_enum_emulation_test.cpp ----------------------------------------------------//
3 // Copyright Beman Dawes, 2009
5 // Distributed under the Boost Software License, Version 1.0.
6 // See http://www.boost.org/LICENSE_1_0.txt
8 // See documentation at http://www.boost.org/libs/utility/scoped_enum_emulation.html
10 #include <boost/detail/scoped_enum_emulation.hpp>
11 #include <boost/assert.hpp>
13 BOOST_SCOPED_ENUM_START(traffic_light
) { red
=0, yellow
, green
}; BOOST_SCOPED_ENUM_END
15 BOOST_SCOPED_ENUM_START(algae
) { green
=0, red
, cyan
}; BOOST_SCOPED_ENUM_END
19 BOOST_SCOPED_ENUM_START(value_t
) { red
, green
, blue
}; BOOST_SCOPED_ENUM_END
20 BOOST_SCOPED_ENUM(value_t
) value
;
23 void foo( BOOST_SCOPED_ENUM(algae
) arg
)
25 BOOST_ASSERT( arg
== algae::cyan
);
30 BOOST_SCOPED_ENUM(traffic_light
) signal( traffic_light::red
);
31 BOOST_SCOPED_ENUM(algae
) sample( algae::red
);
33 BOOST_ASSERT( signal
== traffic_light::red
);
34 BOOST_ASSERT( sample
== algae::red
);
39 tracker
.value
= color::value_t::blue
;