2
0
mirror of https://github.com/boostorg/pfr.git synced 2026-02-01 08:42:14 +00:00
Files
pfr/test/core/cpp26_reflection_detection.cpp
2026-01-31 13:14:24 +03:00

36 lines
661 B
C++

// Copyright (c) 2025-2026 Antony Polukhin
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Detection of C++26 Reflection
#include <type_traits>
#include <version>
#ifndef __cpp_lib_reflection
#error Compiler does not support the required features
#endif
#include <meta>
struct MyPair {
int first;
int second;
};
template <class T>
auto test() {
return T{}.[:
nonstatic_data_members_of(
^^T,
std::meta::access_context::current()
).at(0)
:];
}
int main() {
return ::test<MyPair>();
}