2021-07-18 18:26:12 +02:00
|
|
|
#ifndef BWIDGETS_CONCEPTS_HPP_
|
|
|
|
#define BWIDGETS_CONCEPTS_HPP_
|
|
|
|
|
2021-07-20 15:20:46 +02:00
|
|
|
#include <ostream>
|
|
|
|
#include <string>
|
2021-07-18 18:26:12 +02:00
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
namespace bwidgets::core
|
|
|
|
{
|
2021-07-20 15:20:46 +02:00
|
|
|
template<typename T>
|
|
|
|
concept CanToString = requires(T value) { std::to_string(value); };
|
|
|
|
|
2021-07-18 18:26:12 +02:00
|
|
|
template<typename T>
|
|
|
|
concept Numeric = std::is_arithmetic_v<T>;
|
2021-07-20 15:20:46 +02:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
concept Printable = requires(T value) { std::declval<std::ostream&>() << value; };
|
2021-07-18 18:26:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|