Ion: base/invalid.h Source File

Go to the documentation of this file.

1 

18 #ifndef ION_BASE_INVALID_H_

19 #define ION_BASE_INVALID_H_

20 

21 #include <cstring>

22 

23 namespace ion {

24 namespace base {

25 

30 

34 template <typename T> static const T& InvalidReference() {

36 }

37 

42  return &value == &InvalidReference<T>();

43 }

44 

49  int bad_value = -1;

50  return static_cast<EnumType>(bad_value);

51 }

52 

53 }

54 }

55 

56 #endif // ION_BASE_INVALID_H_

bool IsInvalidReference(const T &value)

IsInvalidReference() returns true if a passed const reference of type T has an address of InvalidRefe...

const size_t kInvalidIndex

kInvalidIndex is a size_t value that is very unlikely to be a valid index.

EnumType InvalidEnumValue()

InvalidEnumValue() returns an invalid enum value, assuming that -1 is not a valid value...