Logger utility class to build error messages for failed assertins.
More...
#include <ostream>
#include <sstream>
#include <type_traits>
#include <utility>
#include <vector>
Go to the source code of this file.
|
using | kassert::internal::OStreamLogger = Logger< std::ostream & > |
| Logger writing all output to a std::ostream . This specialization is used to generate the KASSERT error messages.
|
|
using | kassert::internal::RrefOStringstreamLogger = Logger< std::ostringstream && > |
| Logger writing all output to a rvalue std::ostringstream . This specialization is used to generate the custom error message for THROWING_KASSERT exceptions.
|
|
|
template<typename StreamT , typename ValueT > |
void | kassert::internal::stringify_value (Logger< StreamT > &out, ValueT const &value) |
| Stringify a value using the given assertion logger. If the value cannot be streamed into the logger, print < ?> instead. More...
|
|
template<typename StreamT , typename ValueT , typename AllocatorT > |
Logger< StreamT > & | kassert::operator<< (Logger< StreamT > &logger, std::vector< ValueT, AllocatorT > const &container) |
| Stringification of std::vector<T> in assertions. More...
|
|
template<typename StreamT , typename Key , typename Value > |
Logger< StreamT > & | kassert::operator<< (Logger< StreamT > &logger, std::pair< Key, Value > const &pair) |
| Stringification of std::pair<K, V> in assertions. More...
|
|
|
template<typename StreamT , typename ValueT > |
constexpr bool | kassert::internal::is_streamable_type = is_streamable_type_impl<StreamT, ValueT>::value |
| Determines whether a value of type ValueT can be streamed into an output stream of type StreamT . More...
|
|
Logger utility class to build error messages for failed assertins.
◆ operator<<() [1/2]
template<typename StreamT , typename Key , typename Value >
Logger< StreamT > & kassert::operator<< |
( |
Logger< StreamT > & |
logger, |
|
|
std::pair< Key, Value > const & |
pair |
|
) |
| |
Stringification of std::pair<K, V>
in assertions.
Outputs a std::pair<K, V>
in the following format, where first
and second
are the stringified components of the pair: (first, second)
.
- Template Parameters
-
StreamT | The underlying output stream of the Logger. |
Key | Type of the first component of the pair. |
Value | Type of the second component of the pair. |
- Parameters
-
logger | The assertion logger. |
pair | The pair to be stringified. |
- Returns
- The stringification of the pair as described above.
◆ operator<<() [2/2]
template<typename StreamT , typename ValueT , typename AllocatorT >
Logger< StreamT > & kassert::operator<< |
( |
Logger< StreamT > & |
logger, |
|
|
std::vector< ValueT, AllocatorT > const & |
container |
|
) |
| |
Stringification of std::vector<T>
in assertions.
Outputs a std::vector<T>
in the following format, where element i
are the stringified elements of the vector: [element 1, element 2, ...]
- Template Parameters
-
StreamT | The underlying output stream of the Logger. |
ValueT | The type of the elements contained in the vector. |
AllocatorT | The allocator of the vector. |
- Parameters
-
logger | The assertion logger. |
container | The vector to be stringified. |
- Returns
- The stringified vector as described above.