MADNESS 0.10.1
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 >:
Collaboration diagram for madness::array_of_bools< N >:

Classes

struct  nonempty_default_ctor_tag

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
template<std::size_t C>
array_of_bools and_back (const array_of_bools< C > &a) const
template<std::size_t C>
array_of_bools and_front (const array_of_bools< C > &a) const
bool any () const
auto & as_array ()
const auto & as_array () const
template<std::size_t C>
array_of_bools & assign_back (const array_of_bools< C > &a)
template<std::size_t C>
array_of_bools & assign_front (const array_of_bools< C > &a)
template<std::size_t C>
array_of_bools< C > back () const
template<std::size_t C>
array_of_bools< C > front () const
bool none () const
template<std::size_t C>
array_of_bools or_back (const array_of_bools< C > &a) const
template<std::size_t C>
array_of_bools or_front (const array_of_bools< C > &a) const

Private Member Functions

template<std::size_t NN = N, typename = std::enable_if_t<NN!=0>>
 array_of_bools (nonempty_default_ctor_tag={})

Friends

template<std::size_t NN>
class array_of_bools
array_of_bools< N > operator! (const array_of_bools< N > &a)
array_of_bools< N > operator&& (bool b, const array_of_bools< N > &a)
array_of_bools< N > operator&& (const array_of_bools< N > &a, bool b)
array_of_bools< N > operator&& (const array_of_bools< N > &a, const array_of_bools< N > &b)
array_of_bools< N > operator^ (bool b, const array_of_bools< N > &a)
array_of_bools< N > operator^ (const array_of_bools< N > &a, bool b)
array_of_bools< N > operator^ (const array_of_bools< N > &a, const array_of_bools< N > &b)
array_of_bools< N > operator|| (bool b, const array_of_bools< N > &a)
array_of_bools< N > operator|| (const array_of_bools< N > &a, bool b)
array_of_bools< N > operator|| (const array_of_bools< N > &a, const array_of_bools< N > &b)

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/4]

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/4]

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

constructs an array filled with v

◆ array_of_bools() [3/4]

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...}

◆ array_of_bools() [4/4]

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 ( nonempty_default_ctor_tag = {})
inlineexplicitprivate

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

◆ and_back()

template<std::size_t N>
template<std::size_t C>
array_of_bools madness::array_of_bools< N >::and_back ( const array_of_bools< C > & a) const
inline
Returns
array with last C elements obtained by logical AND between a and the last C elements of this, the rest filled with the remainder of this

◆ and_front()

template<std::size_t N>
template<std::size_t C>
array_of_bools madness::array_of_bools< N >::and_front ( const array_of_bools< C > & a) const
inline
Returns
array with first C elements obtained by logical AND between a and the first C elements of this, the rest filled with the remainder of this

◆ any()

◆ 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

◆ assign_back()

template<std::size_t N>
template<std::size_t C>
array_of_bools & madness::array_of_bools< N >::assign_back ( const array_of_bools< C > & a)
inline

assigns a to the last C elements of this

Parameters
athe array to assign to the back of this
Returns
reference to this object

◆ assign_front()

template<std::size_t N>
template<std::size_t C>
array_of_bools & madness::array_of_bools< N >::assign_front ( const array_of_bools< C > & a)
inline

assigns a to the first C elements of this

Parameters
athe array to assign to the front of this
Returns
reference to this object

◆ back()

template<std::size_t N>
template<std::size_t C>
array_of_bools< C > madness::array_of_bools< N >::back ( ) const
inline
Returns
last C elements

◆ front()

template<std::size_t N>
template<std::size_t C>
array_of_bools< C > madness::array_of_bools< N >::front ( ) const
inline
Returns
first C elements

◆ none()

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

◆ or_back()

template<std::size_t N>
template<std::size_t C>
array_of_bools madness::array_of_bools< N >::or_back ( const array_of_bools< C > & a) const
inline
Returns
array with last C elements obtained by logical OR between a and the last C elements of this, the rest filled with the remainder of this

Referenced by madness::FunctionImpl< T, LDIM >::do_apply().

◆ or_front()

template<std::size_t N>
template<std::size_t C>
array_of_bools madness::array_of_bools< N >::or_front ( const array_of_bools< C > & a) const
inline
Returns
array with first C elements obtained by logical OR between a and the first C elements of this, the rest filled with the remainder of this

Referenced by madness::FunctionImpl< T, LDIM >::do_apply().

◆ array_of_bools

template<std::size_t N>
template<std::size_t NN>
friend class array_of_bools
friend

◆ operator!

template<std::size_t N>
array_of_bools< N > operator! ( const array_of_bools< N > & a)
friend

◆ operator&& [1/3]

template<std::size_t N>
array_of_bools< N > operator&& ( bool b,
const array_of_bools< N > & a )
friend

◆ operator&& [2/3]

template<std::size_t N>
array_of_bools< N > operator&& ( const array_of_bools< N > & a,
bool b )
friend

◆ operator&& [3/3]

template<std::size_t N>
array_of_bools< N > operator&& ( const array_of_bools< N > & a,
const array_of_bools< N > & b )
friend

◆ operator^ [1/3]

template<std::size_t N>
array_of_bools< N > operator^ ( bool b,
const array_of_bools< N > & a )
friend

◆ operator^ [2/3]

template<std::size_t N>
array_of_bools< N > operator^ ( const array_of_bools< N > & a,
bool b )
friend

◆ operator^ [3/3]

template<std::size_t N>
array_of_bools< N > operator^ ( const array_of_bools< N > & a,
const array_of_bools< N > & b )
friend

◆ operator|| [1/3]

template<std::size_t N>
array_of_bools< N > operator|| ( bool b,
const array_of_bools< N > & a )
friend

◆ operator|| [2/3]

template<std::size_t N>
array_of_bools< N > operator|| ( const array_of_bools< N > & a,
bool b )
friend

◆ operator|| [3/3]

template<std::size_t N>
array_of_bools< N > operator|| ( const array_of_bools< N > & a,
const array_of_bools< N > & b )
friend

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