Empty Class

Hi all

i want to know where we can use empty classes?

or what is use of empty class ?

can any one provide some information (example also if possible)

Thanks in advance , sorry for bad english.
Last edited on
Classes are distinct types. An empty class can be used in an intermediate step to force an overload, template instantiation or compile time constant value.

It's never normally used on its own.
They can be used to differentiate between states (see boost::statechart) or execptions that do not require any member data. I'm sure there are other uses, as well, but these are the first that come to mind right now.

Oh! An even better example would be iterator_traits and the empty "tag" classes that are used to differentiate types of iterators passed as template arguments.
Topic archived. No new replies allowed.