Topic: Getting the underlying fixed type of an enum class
Author: "Nevin \":-]\" Liber" <nevin@eviloverlord.com>
Date: Sat, 11 Dec 2010 20:36:08 CST Raw View
Is it possible to extract the underlying fixed type of a scoped
enumeration type? I couldn't find anything in n3225 that would let me,
but it is a big document.
Regards,
Nevin ":-)" LIber
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: =3D?ISO-8859-15?Q?Daniel_Kr=3DFCgler?=3D <daniel.kruegler@googlemail.=.com>
Date: Mon, 13 Dec 2010 11:22:34 CST Raw View
Am 12.12.2010 03:36, schrieb Nevin ":-]" Liber:
> Is it possible to extract the underlying fixed type of a scoped
> enumeration type? I couldn't find anything in n3225 that would let me,
> but it is a big document.
>
Search in 20.7.7.6 Other transformations [meta.trans.other]:
You will find a rather new trait:
template <class T>
struct underlying_type;
"The member typedef type shall name the underlying type of T."
This trait can be used for any enumeration type.
HTH & Greetings from Bremen,
Daniel Kr=FCgler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: "Johannes Schaub (litb)" <schaub-johannes@web.de>
Date: Mon, 13 Dec 2010 11:22:14 CST Raw View
Nevin ":-]" Liber wrote:
>
> Is it possible to extract the underlying fixed type of a scoped
> enumeration type? I couldn't find anything in n3225 that would let me,
> but it is a big document.
>
std::underlying_type<EnumType>::type :)
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]