ant
A2 ant: class-based analysis framework
ant::std_ext Namespace Reference

Classes

struct  _Unique_if
 
struct  _Unique_if< T[]>
 
struct  _Unique_if< T[N]>
 
struct  build_indices
 
struct  build_indices< 0, Is... >
 
struct  cc_shared_ptr
 
class  circit
 
class  execute_on_destroy
 
struct  first_element_is_tuple
 
class  formatter
 The formatter class. More...
 
struct  has_element_type
 
struct  has_element_type< T, void_t< typename T::element_type > >
 
struct  indices
 
struct  IQR
 
struct  is_mapping
 
struct  is_mapping< Container, typename std::enable_if< is_pair< typename std::iterator_traits< typename Container::iterator >::second_type >::value > >
 
struct  is_pair
 
struct  is_pair< std::pair< T, U > >
 
struct  is_specialization_of
 
struct  is_specialization_of< Template< Args... >, Template >
 
struct  is_stl_container_like
 
struct  is_stl_container_like< ant::PiecewiseInterval< T > >
 
struct  is_stl_container_like< std::string >
 
struct  mapped_vectors
 The mapped_vectors struct provides fast access to a collection of vectors. More...
 
struct  RMS_t
 
struct  second_t
 
class  shared_ptr_container
 
struct  shared_ptr_iterator_t
 
struct  system
 
struct  to_integral_helper
 
struct  to_integral_helper< E, typename std::enable_if< std::is_enum< E >::value >::type >
 
struct  tuple_element_void
 
struct  tuple_element_void< I, std::tuple<> >
 
struct  voider
 

Typedefs

using RMS = RMS_t< double >
 
template<class... Args>
using void_t = typename voider< Args... >::type
 

Functions

template<typename Cont >
std::enable_if< is_stl_container_like< Cont >::value, void >::type insertRange (Cont &v, unsigned start, unsigned stop)
 
template<typename Cont , typename U >
std::enable_if< is_stl_container_like< Cont >::value, void >::type concatenate (Cont &dest, const U &src)
 
template<typename Cont , typename U >
std::enable_if< is_stl_container_like< Cont >::value, bool >::type contains (const Cont &v, const U &val)
 
template<typename C , typename = std::enable_if<is_stl_container_like<C>::value>>
void shift_right (C &c)
 Perform a circular rotation on a given container object. More...
 
template<typename C , typename = std::enable_if<is_stl_container_like<C>::value>>
void shift_left (C &c)
 Perform a circular rotation on a given container object. More...
 
template<typename To , typename From >
To clipNegative (const From &x)
 
template<typename T >
circit< T > getCircularIterator (T start, T end)
 
template<typename Map >
second_t< typename Map::value_type > second (const Map &)
 
template<class Pair >
std::enable_if< is_pair< Pair >::value, Pair >::type::second_type get_second (Pair p)
 
template<typename Map , typename = std::enable_if<is_mapping<Map>::value>>
Map::iterator min_map_element (Map &m)
 Takes map-like container and returns an iterator to the pair with the minimum associated key value. More...
 
template<typename Map , typename = std::enable_if<is_mapping<Map>::value>>
Map::iterator max_map_element (Map &m)
 Takes map-like container and returns an iterator to the pair with the maximum associated key value. More...
 
template<typename E >
constexpr auto to_integral (E e) -> decltype(to_integral_helper< E >::inner(e))
 
template<typename T >
constexpr T degree_to_radian (const T &degree) noexcept
 
template<typename T >
constexpr T radian_to_degree (const T &radian) noexcept
 
template<typename T >
constexpr T sqr (const T &x) noexcept
 
template<typename T >
constexpr T abs_diff (T a, T b) noexcept
 
int calcNchooseK (int n, int k)
 
template<typename T , typename Base >
void AddToSharedPtrList (const std::shared_ptr< Base > base, std::list< std::shared_ptr< T > > &list)
 
template<typename From , typename To >
std::unique_ptr< To > static_cast_uptr (std::unique_ptr< From > &&ptr)
 
template<class T , class... Args>
_Unique_if< T >::_Single_object make_unique (Args &&... args)
 
template<class T >
_Unique_if< T >::_Unknown_bound make_unique (size_t n)
 
template<class T , class... Args>
_Unique_if< T >::_Known_bound make_unique (Args &&...)=delete
 
template<class T , class U , class Better >
bool copy_if_better (T &dest, const U &source, Better better)
 
template<class T , class U >
bool copy_if_greater (T &dest, const U &source)
 
template<class TContainer >
bool begins_with (const TContainer &input, const TContainer &match)
 
template<typename T >
std::string getTypeAsString ()
 
template<typename T >
std::remove_pointer< T >::type dereference (T *t)
 
template<typename T >
std::enable_if<!has_element_type< T >::value, T & >::type dereference (T &t)
 
template<typename T >
std::enable_if< has_element_type< T >::value, typename T::element_type & >::type dereference (const T &t)
 
template<class it_t , class T = decltype(*std::declval<it_t>())>
constexpr bool is_const_iterator ()
 
bool string_ends_with (std::string const &value, std::string const &ending)
 Check if a string ends with a substr. For example useful for file extensions. More...
 
bool string_starts_with (std::string const &value, std::string const &beginning)
 
void replace (std::string &subject, const std::string &search, const std::string &replace)
 replace a substring More...
 
std::string replace_str (const std::string &input, const std::string &search, const std::string &replace)
 
std::string string_sanitize (std::string s)
 string_sanitize removes nasty whitespace from string More...
 
bool contains (const std::string &str, const std::string &needle)
 
void removesubstr (std::string &str, const std::string &substr)
 Remove all occurences of substr from str. More...
 
void remove_char (std::string &str, const char ch)
 Remove all occurences of charachter ch from str. More...
 
void remove_chars (std::string &str, const std::initializer_list< const char > chars)
 Remove all occurences of certain charachters from str. More...
 
std::string basename (const std::string &filenamepath)
 
std::vector< std::string > tokenize_string (const std::string &str, const std::string &delim)
 
std::string concatenate_string (const std::vector< std::string > &tokens, const std::string &delim)
 
std::string to_lower (const std::string &str)
 
std::string to_upper (const std::string &str)
 
std::string to_iso8601 (const time_t &time)
 
std::tm to_tm (const std::string &str, const std::string &fmt)
 
time_t to_time_t (const std::tm &tm_)
 
time_t to_time_t (const std::string &str, bool is_end)
 
bool time_before (const time_t &moment, const std::string &before)
 
bool time_after (const time_t &moment, const std::string &after)
 
bool time_between (const time_t &moment, const std::string &begin, const std::string &end)
 
int get_day_of_week (int day, int month, int year)
 
bool guess_dst (std::tm &time)
 
template<typename T , typename... Ts, std::size_t... Idx>
constexpr std::tuple< Ts... > strip_first_from_tuple_impl (const std::tuple< T, Ts... > &t, indices< Idx... >) noexcept
 
template<typename T , typename... Ts>
constexpr std::tuple< Ts... > strip_first_from_tuple (const std::tuple< T, Ts... > &t) noexcept
 
template<typename T >
std::vector< size_t > get_sorted_indices (std::vector< T > vec)
 Takes a vector and compares its contents to obtain sorted indices. More...
 
template<typename T >
std::vector< size_t > get_sorted_indices_desc (std::vector< T > vec)
 Takes a vector and compares its contents to obtain sorted indices in descending order. More...
 

Variables

constexpr double inf = std::numeric_limits<double>::infinity()
 
constexpr double NaN = std::numeric_limits<double>::quiet_NaN()
 

Typedef Documentation

◆ RMS

using ant::std_ext::RMS = typedef RMS_t<double>

◆ void_t

template<class... Args>
using ant::std_ext::void_t = typedef typename voider<Args...>::type

Function Documentation

◆ abs_diff()

template<typename T >
constexpr T ant::std_ext::abs_diff ( a,
b 
)
inlinenoexcept

◆ AddToSharedPtrList()

template<typename T , typename Base >
void ant::std_ext::AddToSharedPtrList ( const std::shared_ptr< Base >  base,
std::list< std::shared_ptr< T > > &  list 
)

◆ basename()

std::string ant::std_ext::basename ( const std::string &  filenamepath)
inline

◆ begins_with()

template<class TContainer >
bool ant::std_ext::begins_with ( const TContainer &  input,
const TContainer &  match 
)

◆ calcNchooseK()

int ant::std_ext::calcNchooseK ( int  n,
int  k 
)

◆ clipNegative()

template<typename To , typename From >
To ant::std_ext::clipNegative ( const From &  x)

◆ concatenate()

template<typename Cont , typename U >
std::enable_if<is_stl_container_like<Cont>::value, void>::type ant::std_ext::concatenate ( Cont &  dest,
const U &  src 
)

◆ concatenate_string()

std::string ant::std_ext::concatenate_string ( const std::vector< std::string > &  tokens,
const std::string &  delim 
)
inline

◆ contains() [1/2]

template<typename Cont , typename U >
std::enable_if<is_stl_container_like<Cont>::value, bool>::type ant::std_ext::contains ( const Cont &  v,
const U &  val 
)

◆ contains() [2/2]

bool ant::std_ext::contains ( const std::string &  str,
const std::string &  needle 
)
inline

◆ copy_if_better()

template<class T , class U , class Better >
bool ant::std_ext::copy_if_better ( T &  dest,
const U &  source,
Better  better 
)

◆ copy_if_greater()

template<class T , class U >
bool ant::std_ext::copy_if_greater ( T &  dest,
const U &  source 
)

◆ degree_to_radian()

template<typename T >
constexpr T ant::std_ext::degree_to_radian ( const T &  degree)
inlinenoexcept

◆ dereference() [1/3]

template<typename T >
std::remove_pointer<T>::type ant::std_ext::dereference ( T *  t)

◆ dereference() [2/3]

template<typename T >
std::enable_if<!has_element_type<T>::value, T&>::type ant::std_ext::dereference ( T &  t)

◆ dereference() [3/3]

template<typename T >
std::enable_if<has_element_type<T>::value, typename T::element_type&>::type ant::std_ext::dereference ( const T &  t)

◆ get_day_of_week()

int ant::std_ext::get_day_of_week ( int  day,
int  month,
int  year 
)
inline

◆ get_second()

template<class Pair >
std::enable_if<is_pair<Pair>::value, Pair>::type::second_type ant::std_ext::get_second ( Pair  p)

◆ get_sorted_indices()

template<typename T >
std::vector<size_t> ant::std_ext::get_sorted_indices ( std::vector< T >  vec)

Takes a vector and compares its contents to obtain sorted indices.

Parameters
vecvector containing comparable objects
Returns
vector<size_t> of sorted indices

◆ get_sorted_indices_desc()

template<typename T >
std::vector<size_t> ant::std_ext::get_sorted_indices_desc ( std::vector< T >  vec)

Takes a vector and compares its contents to obtain sorted indices in descending order.

Parameters
vecvector containing comparable objects
Returns
vector<size_t> of sorted indices

◆ getCircularIterator()

template<typename T >
circit<T> ant::std_ext::getCircularIterator ( start,
end 
)

◆ getTypeAsString()

template<typename T >
std::string ant::std_ext::getTypeAsString ( )

◆ guess_dst()

bool ant::std_ext::guess_dst ( std::tm &  time)
inline

◆ insertRange()

template<typename Cont >
std::enable_if<is_stl_container_like<Cont>::value, void>::type ant::std_ext::insertRange ( Cont &  v,
unsigned  start,
unsigned  stop 
)

◆ is_const_iterator()

template<class it_t , class T = decltype(*std::declval<it_t>())>
constexpr bool ant::std_ext::is_const_iterator ( )

◆ make_unique() [1/3]

template<class T , class... Args>
_Unique_if<T>::_Single_object ant::std_ext::make_unique ( Args &&...  args)

◆ make_unique() [2/3]

template<class T >
_Unique_if<T>::_Unknown_bound ant::std_ext::make_unique ( size_t  n)

◆ make_unique() [3/3]

template<class T , class... Args>
_Unique_if<T>::_Known_bound ant::std_ext::make_unique ( Args &&  ...)
delete

◆ max_map_element()

template<typename Map , typename = std::enable_if<is_mapping<Map>::value>>
Map::iterator ant::std_ext::max_map_element ( Map &  m)

Takes map-like container and returns an iterator to the pair with the maximum associated key value.

Parameters
mapmap-like container with comparable objects
Returns
map::iterator to element with max value

◆ min_map_element()

template<typename Map , typename = std::enable_if<is_mapping<Map>::value>>
Map::iterator ant::std_ext::min_map_element ( Map &  m)

Takes map-like container and returns an iterator to the pair with the minimum associated key value.

Parameters
mapmap-like container with comparable objects
Returns
map::iterator to element with min value

◆ radian_to_degree()

template<typename T >
constexpr T ant::std_ext::radian_to_degree ( const T &  radian)
inlinenoexcept

◆ remove_char()

void ant::std_ext::remove_char ( std::string &  str,
const char  ch 
)
inline

Remove all occurences of charachter ch from str.

Parameters
strString to modify
chcharacter to remove

◆ remove_chars()

void ant::std_ext::remove_chars ( std::string &  str,
const std::initializer_list< const char >  chars 
)
inline

Remove all occurences of certain charachters from str.

Parameters
strString to modify
charsinitializer_list containing characters to be removed

◆ removesubstr()

void ant::std_ext::removesubstr ( std::string &  str,
const std::string &  substr 
)
inline

Remove all occurences of substr from str.

Parameters
strString to modify
substrsubstring to remove

◆ replace()

void ant::std_ext::replace ( std::string &  subject,
const std::string &  search,
const std::string &  replace 
)
inline

replace a substring

Parameters
subjectis modified
search
replace

◆ replace_str()

std::string ant::std_ext::replace_str ( const std::string &  input,
const std::string &  search,
const std::string &  replace 
)
inline

◆ second()

template<typename Map >
second_t<typename Map::value_type> ant::std_ext::second ( const Map &  )

◆ shift_left()

template<typename C , typename = std::enable_if<is_stl_container_like<C>::value>>
void ant::std_ext::shift_left ( C &  c)

Perform a circular rotation on a given container object.

Parameters
ccontainer whose values get shifted

◆ shift_right()

template<typename C , typename = std::enable_if<is_stl_container_like<C>::value>>
void ant::std_ext::shift_right ( C &  c)

Perform a circular rotation on a given container object.

Parameters
ccontainer whose values get shifted

◆ sqr()

template<typename T >
constexpr T ant::std_ext::sqr ( const T &  x)
inlinenoexcept

◆ static_cast_uptr()

template<typename From , typename To >
std::unique_ptr<To> ant::std_ext::static_cast_uptr ( std::unique_ptr< From > &&  ptr)
inline

◆ string_ends_with()

bool ant::std_ext::string_ends_with ( std::string const &  value,
std::string const &  ending 
)
inline

Check if a string ends with a substr. For example useful for file extensions.

Parameters
valueString to check
endingEnding to check for
Returns
true it value ends with ending

◆ string_sanitize()

std::string ant::std_ext::string_sanitize ( std::string  s)
inline

string_sanitize removes nasty whitespace from string

Parameters
in
Returns

◆ string_starts_with()

bool ant::std_ext::string_starts_with ( std::string const &  value,
std::string const &  beginning 
)
inline

◆ strip_first_from_tuple()

template<typename T , typename... Ts>
constexpr std::tuple<Ts...> ant::std_ext::strip_first_from_tuple ( const std::tuple< T, Ts... > &  t)
noexcept

◆ strip_first_from_tuple_impl()

template<typename T , typename... Ts, std::size_t... Idx>
constexpr std::tuple<Ts...> ant::std_ext::strip_first_from_tuple_impl ( const std::tuple< T, Ts... > &  t,
indices< Idx... >   
)
noexcept

◆ time_after()

bool ant::std_ext::time_after ( const time_t &  moment,
const std::string &  after 
)
inline

◆ time_before()

bool ant::std_ext::time_before ( const time_t &  moment,
const std::string &  before 
)
inline

◆ time_between()

bool ant::std_ext::time_between ( const time_t &  moment,
const std::string &  begin,
const std::string &  end 
)
inline

◆ to_integral()

template<typename E >
constexpr auto ant::std_ext::to_integral ( e) -> decltype(to_integral_helper<E>::inner(e))

◆ to_iso8601()

std::string ant::std_ext::to_iso8601 ( const time_t &  time)
inline

◆ to_lower()

std::string ant::std_ext::to_lower ( const std::string &  str)
inline

◆ to_time_t() [1/2]

time_t ant::std_ext::to_time_t ( const std::tm &  tm_)
inline

◆ to_time_t() [2/2]

time_t ant::std_ext::to_time_t ( const std::string &  str,
bool  is_end 
)
inline

◆ to_tm()

std::tm ant::std_ext::to_tm ( const std::string &  str,
const std::string &  fmt 
)
inline

◆ to_upper()

std::string ant::std_ext::to_upper ( const std::string &  str)
inline

◆ tokenize_string()

std::vector<std::string> ant::std_ext::tokenize_string ( const std::string &  str,
const std::string &  delim 
)
inline

Variable Documentation

◆ inf

constexpr double ant::std_ext::inf = std::numeric_limits<double>::infinity()

◆ NaN

constexpr double ant::std_ext::NaN = std::numeric_limits<double>::quiet_NaN()