bwidgets/inc/basic_widgets/core/type/concepts.hpp

29 lines
532 B
C++
Raw Normal View History

#ifndef BWIDGETS_CONCEPTS_HPP
#define BWIDGETS_CONCEPTS_HPP
#include <string>
#include <type_traits>
2021-08-06 14:22:56 +02:00
namespace bwidgets
{
template<typename T>
concept CanToString = requires(T value)
{
std::to_string(value);
};
2021-08-06 14:22:56 +02:00
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