Intel® Cilk™ Plus Include Directory  Revision 4358
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Static Public Attributes | List of all members
cilk::internal::class_is_empty< Class > Class Template Reference

Test if a class is empty. More...

Static Public Attributes

static const bool value = (sizeof(check_for_empty_class) == sizeof(char))
 Constant is true if and only if Class is empty.

Detailed Description

template<class Class>
class cilk::internal::class_is_empty< Class >

Test if a class is empty.

If Class is an empty (and therefore necessarily stateless) class, then the "empty base-class optimization" guarantees that sizeof(check_for_empty_class<Class>) == sizeof(char). Conversely, if sizeof(check_for_empty_class<Class>) > sizeof(char), then Class is not empty, and we must discriminate distinct instances of Class.

Typical usage:

// General definition of A<B> for non-empty B:
template <typename B, bool BIsEmpty = class_is_empty<B>::value> >
class A { ... };

// Specialized definition of A<B> for empty B:
template <typename B>
class A<B, true> { ... };
Template Parameters
ClassThe class to be tested for emptiness.
The value member will be true if Class is empty, false otherwise.

The documentation for this class was generated from the following file:
© 2015 Intel Corporation. All rights reserved. | Intel and Cilk are trademarks of Intel Corporation in the U.S. and/or other countries