A C++ template library for embedded applications
MIT licensed
Join the ETL community
Designed and
maintained by
John Wellbelove
Like the ETL? Become a patron!

Utility


A few useful utility functions and classes.
___________________________________________________________________________________________________
pair

template <typename T1, typename T2>
struct pair

A clone of std::pair

C++03
template <typename T1, typename T2>
pair<T1, T2> make_pair(T1 a, T2 b)

C++11 and above
template <typename T1, typename T2>
pair<T1, T2> make_pair(T1&& a, T2&& b)

Returns a pair.
____________________________________________________________________________________________________
exchange

template <typename T, typename U = T>
T exchange(T& object, const U& new_value)

Copies the new value to object and returns the old value.
Note: This is not an atomic operation.

____________________________________________________________________________________________________
add_cost

template <typename T>
typename etl::add_const<T>::type& as_const(T& t)

Returns a value of type T as a const T.

utility.h