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...
 
static type value_of (bool value)
 Converts the the built-in bool 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().

static type zorba::internal::ztd::explicit_bool::value_of ( bool  value)
inlinestatic

Converts the the built-in bool value to an explicit bool value.

Parameters
valueThe bool value to convert.
Returns
Return said value.

Definition at line 418 of file ztd.h.

References false_value(), and true_value().

Referenced by std::unique_ptr< zorba::internal::ztd::proxy >::operator explicit_bool::type().


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