User Defined Types & static const

J

JackSpades

Given the following:

template<typename T, T V>
struct StaticConst {
static const T Value = V;
};

What types can T take? Only the various int's?
 
J

John Harrison

JackSpades said:
Given the following:

template<typename T, T V>
struct StaticConst {
static const T Value = V;
};

What types can T take? Only the various int's?

In class initialisation of static const members is only allowed for
integral types so I would say yes, only integers, characters and booleans.

john
 
G

Greg Comeau

In class initialisation of static const members is only allowed for
integral types so I would say yes, only integers, characters and booleans.

And enumerations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top