zypp::base::SafeBool< _Derived > Struct Template Reference

Validate objects in a boolean context without harmful side effects. More...

#include <SafeBool.h>

Inheritance diagram for zypp::base::SafeBool< _Derived >:

List of all members.

Public Types


Public Member Functions

 operator bool_type () const

Protected Member Functions

 ~SafeBool ()

Detailed Description

template<class _Derived>
struct zypp::base::SafeBool< _Derived >

Validate objects in a boolean context without harmful side effects.

See also:

Uses CRTP to avoid a virtual function. _Derived must provide bool boolTest() const preformong the test.

Using SafeBool enables ==/!= comparision for Foo, based on the bool_type values. Make shure you overload both operators, in case an other semantic is desired for ==/!=.
 class Foo : protected base::SafeBool<Foo>
   using base::SafeBool<Foo>::operator bool_type;

   friend SafeBool<TT>::operator bool_type() const;
   bool boolTest() const
     // Perform Boolean logic here
Investigate why Bit refuses private inheritance and exposition of operator bool_type. Seems to be a gcc bug. protected works.

Definition at line 70 of file SafeBool.h.

Member Typedef Documentation

template<class _Derived>
typedef safebool_detail::SafeBoolBase::bool_type zypp::base::SafeBool< _Derived >::bool_type

Constructor & Destructor Documentation

template<class _Derived>
zypp::base::SafeBool< _Derived >::~SafeBool (  )  [inline, protected]

Definition at line 80 of file SafeBool.h.

Member Function Documentation

template<class _Derived>
zypp::base::SafeBool< _Derived >::operator bool_type (  )  const [inline]

Definition at line 73 of file SafeBool.h.

The documentation for this struct was generated from the following file:
Generated on Fri Mar 2 09:46:12 2012 for libzypp by  doxygen 1.6.3