zorba::internal::ztd::explicit_bool

#include <zorba/internal/ztd.h>

Helper class for implementing a solution to the "explicit bool conversion" problem. The canonical use is of the form:
  class your_class {
    // ...
    operator explicit_bool::type() const {
      return explicit_bool::value_of( some_expression );
    }
  };
See: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2333.html

Public Types

int pointer_conversion::*

type

Public Static Functions

type

false_value()

Gets the explicit bool value for false.

type

true_value()

Gets the explicit bool value for true.

std::enable_if< ZORBA_TR1_NS::is_convertible< T, bool >::value, type >::type

value_of(T const &value)

Converts the given value to an explicit bool value.

Public Types

type

int pointer_conversion::* type

Public Static Functions

false_value

type false_value()

Gets the explicit bool value for false.

Returns

Returns said value.

true_value

type true_value()

Gets the explicit bool value for true.

Returns

Returns said value.

value_of

std::enable_if< ZORBA_TR1_NS::is_convertible< T, bool >::value, type >::type value_of(T const &value)

Converts the given value to an explicit bool value.

Parameters

T The type of the value to convert.

Parameters

value The value to convert.

Returns

Return said value.