22 lines
492 B
C++
22 lines
492 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
template <auto v>
|
|
struct C
|
|
{
|
|
using type = C<v>;
|
|
static constexpr auto value = v;
|
|
using value_type = decltype(v);
|
|
inline constexpr operator value_type() const noexcept { return value; }
|
|
inline constexpr value_type operator()() const noexcept { return value; }
|
|
};
|
|
|
|
int main()
|
|
{
|
|
using _1 = C<10>;
|
|
auto x = _1{};
|
|
cout << _1::value << endl;
|
|
cout << _1::value_type() << endl;
|
|
cout << x.value << endl;
|
|
return 0;
|
|
} |