|
||||
File indexing completed on 2025-01-18 09:43:37
0001 // Copyright (c) 2023 Bela Schaum, X-Ryl669, Denis Mikhailov. 0002 // 0003 // Distributed under the Boost Software License, Version 1.0. (See accompanying 0004 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0005 0006 0007 // Initial implementation by Bela Schaum, https://github.com/schaumb 0008 // The way to make it union and UB free by X-Ryl669, https://github.com/X-Ryl669 0009 // 0010 0011 #ifndef BOOST_PFR_DETAIL_FAKE_OBJECT_HPP 0012 #define BOOST_PFR_DETAIL_FAKE_OBJECT_HPP 0013 #pragma once 0014 0015 #include <boost/pfr/detail/config.hpp> 0016 0017 namespace boost { namespace pfr { namespace detail { 0018 0019 // This variable serves as a compile-time assert. If you see any error here, then 0020 // you're probably using `boost::pfr::get_name()` or `boost::pfr::names_as_array()` with a non-external linkage type. 0021 template <class T> 0022 extern const T passed_type_has_no_external_linkage; 0023 0024 // For returning non default constructible types, it's exclusively used in member name retrieval. 0025 // 0026 // Neither std::declval nor boost::pfr::detail::unsafe_declval are usable there. 0027 // Limitation - T should have external linkage. 0028 template <class T> 0029 constexpr const T& fake_object() noexcept { 0030 return passed_type_has_no_external_linkage<T>; 0031 } 0032 0033 }}} // namespace boost::pfr::detail 0034 0035 #endif // BOOST_PFR_DETAIL_FAKE_OBJECT_HPP 0036
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |