31 lines
554 B
C++
31 lines
554 B
C++
#ifndef BWIDGETS_CONCEPTS_HPP_
|
|
#define BWIDGETS_CONCEPTS_HPP_
|
|
|
|
#include <ostream>
|
|
#include <string>
|
|
|
|
#include <type_traits>
|
|
|
|
namespace bwidgets
|
|
{
|
|
template<typename T>
|
|
concept CanToString = requires(T value)
|
|
{
|
|
std::to_string(value);
|
|
};
|
|
|
|
template<typename T>
|
|
concept FloatingPoint = std::is_floating_point_v<T>;
|
|
|
|
template<typename T>
|
|
concept Numeric = std::is_arithmetic_v<T>;
|
|
|
|
template<typename T>
|
|
concept Printable = requires(T value)
|
|
{
|
|
std::declval<std::ostream&>() << value;
|
|
};
|
|
}
|
|
|
|
#endif
|