]> git.lyx.org Git - lyx.git/blob - boost/boost/detail/scoped_enum_emulation.hpp
Don't need this.
[lyx.git] / boost / boost / detail / scoped_enum_emulation.hpp
1 //  scoped_enum_emulation.hpp  ---------------------------------------------------------//\r
2 \r
3 //  Copyright Beman Dawes, 2009\r
4 \r
5 //  Distributed under the Boost Software License, Version 1.0.\r
6 //  See http://www.boost.org/LICENSE_1_0.txt\r
7 \r
8 //  Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x\r
9 //  scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS\r
10 //  macro is used to detect feature support.\r
11 //\r
12 //  See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a\r
13 //  description of the scoped enum feature. Note that the committee changed the name\r
14 //  from strongly typed enum to scoped enum.  \r
15 //\r
16 //  Caution: only the syntax is emulated; the semantics are not emulated and\r
17 //  the syntax emulation doesn't include being able to specify the underlying\r
18 //  representation type.\r
19 //\r
20 //  The emulation is via struct rather than namespace to allow use within classes.\r
21 //  Thanks to Andrey Semashev for pointing that out.\r
22 //\r
23 //  Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott,\r
24 //  Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente\r
25 //  Botet, and Daniel James. \r
26 //\r
27 //  Sample usage:\r
28 //\r
29 //     BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END\r
30 //     ...\r
31 //     BOOST_SCOPED_ENUM(algae) sample( algae::red );\r
32 //     void foo( BOOST_SCOPED_ENUM(algae) color );\r
33 //     ...\r
34 //     sample = algae::green;\r
35 //     foo( algae::cyan );\r
36 \r
37 #ifndef BOOST_SCOPED_ENUM_EMULATION_HPP\r
38 #define BOOST_SCOPED_ENUM_EMULATION_HPP\r
39 \r
40 #include <boost/config.hpp>\r
41 \r
42 #ifdef BOOST_NO_SCOPED_ENUMS\r
43 \r
44 # define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_t\r
45 # define BOOST_SCOPED_ENUM_END };\r
46 # define BOOST_SCOPED_ENUM(name) name::enum_t\r
47 \r
48 #else\r
49 \r
50 # define BOOST_SCOPED_ENUM_START(name) enum class name\r
51 # define BOOST_SCOPED_ENUM_END\r
52 # define BOOST_SCOPED_ENUM(name) name\r
53 \r
54 #endif\r
55 \r
56 #endif  // BOOST_SCOPED_ENUM_EMULATION_HPP\r