MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
istringify.hpp
1#ifndef MSTL_CORE_INTERFACE_ISTRINGIFY_HPP__
2#define MSTL_CORE_INTERFACE_ISTRINGIFY_HPP__
3#include "../string/string.hpp"
5
6template <typename T>
7struct istringify {
8private:
9 constexpr const T& derived() const noexcept {
10 return static_cast<const T&>(*this);
11 }
12
13public:
14 MSTL_NODISCARD MSTL_CONSTEXPR20 string to_string() const {
15 return derived().to_string();
16 }
17};
18
19template <typename T, enable_if_t<is_base_of_v<istringify<T>, T>, int> = 0>
20MSTL_NODISCARD MSTL_CONSTEXPR20 string to_string(const T& obj) {
21 return obj.to_string();
22}
23
25#endif // MSTL_CORE_INTERFACE_ISTRINGIFY_HPP__
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL