All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
icarus::details::IntegerRangesBase< T >::Range_t Struct Reference

#include <IntegerRanges.h>

Public Member Functions

constexpr Range_t () noexcept=default
 
constexpr Range_t (Data_t lower, Data_t upper) noexcept
 
constexpr bool empty () const noexcept
 
constexpr std::size_t size () const noexcept
 
constexpr bool isOne () const noexcept
 
constexpr bool isTwo () const noexcept
 
void dump (std::ostream &out, std::string const &sep, std::string const &simpleSep) const
 
void dump (std::ostream &out, std::string const &sep="--") const
 

Public Attributes

Data_t lower {}
 
Data_t upper {}
 

Detailed Description

template<typename T = int>
struct icarus::details::IntegerRangesBase< T >::Range_t

Definition at line 81 of file IntegerRanges.h.

Constructor & Destructor Documentation

template<typename T = int>
constexpr icarus::details::IntegerRangesBase< T >::Range_t::Range_t ( )
defaultnoexcept
template<typename T >
constexpr icarus::details::IntegerRangesBase< T >::Range_t::Range_t ( Data_t  lower,
Data_t  upper 
)
noexcept

Member Function Documentation

template<typename T >
void icarus::details::IntegerRangesBase< T >::Range_t::dump ( std::ostream &  out,
std::string const &  sep,
std::string const &  simpleSep 
) const

Definition at line 270 of file IntegerRanges.h.

272 {
273 
274  if (empty()) {
275  // let's say we don't print nothing at all
276  return;
277  }
278 
279  out << lower;
280  if (isOne()) return;
281 
282  out << (isTwo()? simpleSep: sep) << icarus::details::IntegerRangesBase<T>::minusOne(upper);
283  return;
284 
285 } // icarus::details::IntegerRangesBase<>::Range_t::dump()
constexpr bool empty() const noexcept
constexpr bool isOne() const noexcept
template<typename T >
void icarus::details::IntegerRangesBase< T >::Range_t::dump ( std::ostream &  out,
std::string const &  sep = "--" 
) const

Definition at line 291 of file IntegerRanges.h.

292  { dump(out, sep, sep); }
void dump(std::ostream &out, std::string const &sep, std::string const &simpleSep) const
template<typename T >
constexpr bool icarus::details::IntegerRangesBase< T >::Range_t::empty ( ) const
noexcept
template<typename T >
constexpr bool icarus::details::IntegerRangesBase< T >::Range_t::isOne ( ) const
noexcept

Definition at line 256 of file IntegerRanges.h.

257  { return plusOne(lower) == upper; }
static constexpr Data_t plusOne(Data_t value) noexcept
Returns value incremented by 1.
template<typename T >
constexpr bool icarus::details::IntegerRangesBase< T >::Range_t::isTwo ( ) const
noexcept

Definition at line 263 of file IntegerRanges.h.

264  { return plusOne(lower) == minusOne(upper); }
static constexpr Data_t plusOne(Data_t value) noexcept
Returns value incremented by 1.
static constexpr Data_t minusOne(Data_t value) noexcept
Returns value decremented by 1.
template<typename T >
constexpr std::size_t icarus::details::IntegerRangesBase< T >::Range_t::size ( ) const
noexcept

Member Data Documentation

template<typename T = int>
Data_t icarus::details::IntegerRangesBase< T >::Range_t::lower {}

Definition at line 83 of file IntegerRanges.h.

template<typename T = int>
Data_t icarus::details::IntegerRangesBase< T >::Range_t::upper {}

Definition at line 84 of file IntegerRanges.h.


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