Public Types | Static Public Member Functions | List of all members
zorba::internal::ztd::explicit_bool Class Reference

Helper class for implementing a solution to the "explicit bool conversion" problem. More...

#include <zorba/internal/ztd.h>

Public Types

typedef int pointer_conversion::* type
 

Static Public Member Functions

static type false_value ()
 Gets the explicit bool value for false. More...
 
static type true_value ()
 Gets the explicit bool value for true. More...
 
template<typename T >
static 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. More...
 

Detailed Description

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

Definition at line 389 of file ztd.h.

Member Typedef Documentation

typedef int pointer_conversion::* zorba::internal::ztd::explicit_bool::type

Definition at line 392 of file ztd.h.

Member Function Documentation

static type zorba::internal::ztd::explicit_bool::false_value ( )
inlinestatic

Gets the explicit bool value for false.

Returns
Returns said value.

Definition at line 399 of file ztd.h.

Referenced by value_of().

static type zorba::internal::ztd::explicit_bool::true_value ( )
inlinestatic

Gets the explicit bool value for true.

Returns
Returns said value.

Definition at line 408 of file ztd.h.

Referenced by value_of().

template<typename T >
static std::enable_if<ZORBA_TR1_NS::is_convertible<T,bool>::value, type>::type zorba::internal::ztd::explicit_bool::value_of ( T const &  value)
inlinestatic

Converts the given value to an explicit bool value.

Template Parameters
TThe type of the value to convert.
Parameters
valueThe value to convert.
Returns
Return said value.

Definition at line 422 of file ztd.h.

References false_value(), and true_value().

Referenced by std::unique_ptr< zorba::Sequence::iterator >::operator explicit_bool::type().


The documentation for this class was generated from the following file:
blog comments powered by Disqus