torch_ext/test.cc

22 lines
492 B
C++
Raw Normal View History

2024-11-18 19:54:12 +08:00
#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;
}