| 1 | // |
| 2 | // Copyright (c) 2022-2023 Alexander Grund |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. |
| 5 | // https://www.boost.org/LICENSE_1_0.txt |
| 6 | |
| 7 | #ifndef BOOST_LOCALE_DETAIL_FACET_ID_HPP_INCLUDED |
| 8 | #define BOOST_LOCALE_DETAIL_FACET_ID_HPP_INCLUDED |
| 9 | |
| 10 | #include <boost/locale/config.hpp> |
| 11 | #include <locale> |
| 12 | |
| 13 | /// \cond INTERNAL |
| 14 | namespace boost { namespace locale { namespace detail { |
| 15 | #if BOOST_CLANG_VERSION >= 40900 |
| 16 | # pragma clang diagnostic push |
| 17 | # pragma clang diagnostic ignored "-Wundefined-var-template" |
| 18 | #endif |
| 19 | /// CRTP base class to hold the id required for facets |
| 20 | /// |
| 21 | /// Required because the id needs to be defined in a CPP file and hence ex/imported for shared libraries. |
| 22 | /// However the virtual classes need to be declared as BOOST_VISIBLE to combine the VTables because otherwise |
| 23 | /// casts/virtual-calls might be flagged as invalid by UBSAN |
| 24 | template<class Derived> |
| 25 | struct BOOST_LOCALE_DECL facet_id { |
| 26 | static std::locale::id id; |
| 27 | }; |
| 28 | #if BOOST_CLANG_VERSION >= 40900 |
| 29 | # pragma clang diagnostic pop |
| 30 | #endif |
| 31 | }}} // namespace boost::locale::detail |
| 32 | |
| 33 | /// \endcond |
| 34 | |
| 35 | #endif |
| 36 | |