MADNESS 0.10.1
Public Types | Public Member Functions | List of all members
madness::array_of_bools< N > Class Template Reference

syntactic sugar for std::array<bool, N> More...

#include <array_of_bools.h>

Inheritance diagram for madness::array_of_bools< N >:
Inheritance graph
[legend]
Collaboration diagram for madness::array_of_bools< N >:
Collaboration graph
[legend]

Public Types

using base_type = std::array< bool, N >
 

Public Member Functions

template<std::size_t NN = N, typename = std::enable_if_t<NN==0>>
 array_of_bools ()
 default ctor public only for N==0
 
 array_of_bools (bool v)
 constructs an array filled with v
 
template<typename ... Bools, typename = std::enable_if_t<sizeof...(Bools)+1==N>>
 array_of_bools (bool v, Bools... vs)
 constructs an array filled with {v, vs...}
 
bool all () const
 
bool any () const
 
auto & as_array ()
 
const auto & as_array () const
 
bool none () const
 

Detailed Description

template<std::size_t N>
class madness::array_of_bools< N >

syntactic sugar for std::array<bool, N>

reason to exist: so can apply logical operations to the entire pack of bools, e.g. a && b, and perform queries like a.any(), a.none(), etc.

Member Typedef Documentation

◆ base_type

template<std::size_t N>
using madness::array_of_bools< N >::base_type = std::array<bool, N>

Constructor & Destructor Documentation

◆ array_of_bools() [1/3]

template<std::size_t N>
template<std::size_t NN = N, typename = std::enable_if_t<NN==0>>
madness::array_of_bools< N >::array_of_bools ( )
inline

default ctor public only for N==0

◆ array_of_bools() [2/3]

template<std::size_t N>
madness::array_of_bools< N >::array_of_bools ( bool  v)
inlineexplicit

constructs an array filled with v

References madness::array_of_bools< N >::as_array(), and v.

◆ array_of_bools() [3/3]

template<std::size_t N>
template<typename ... Bools, typename = std::enable_if_t<sizeof...(Bools)+1==N>>
madness::array_of_bools< N >::array_of_bools ( bool  v,
Bools...  vs 
)
inlineexplicit

constructs an array filled with {v, vs...}

References v.

Member Function Documentation

◆ all()

template<std::size_t N>
bool madness::array_of_bools< N >::all ( ) const
inline
Returns
true if all elements are true

◆ any()

template<std::size_t N>
bool madness::array_of_bools< N >::any ( ) const
inline

◆ as_array() [1/2]

template<std::size_t N>
auto & madness::array_of_bools< N >::as_array ( )
inline

◆ as_array() [2/2]

template<std::size_t N>
const auto & madness::array_of_bools< N >::as_array ( ) const
inline

◆ none()

template<std::size_t N>
bool madness::array_of_bools< N >::none ( ) const
inline
Returns
true if no elements are true

References madness::array_of_bools< N >::any().


The documentation for this class was generated from the following file: