Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:45

0001 //
0002 // Copyright (c) 2020 Alexander Grund
0003 //
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // https://www.boost.org/LICENSE_1_0.txt
0006 
0007 #ifndef BOOST_NOWIDE_DETAIL_IS_PATH_HPP_INCLUDED
0008 #define BOOST_NOWIDE_DETAIL_IS_PATH_HPP_INCLUDED
0009 
0010 #include <type_traits>
0011 
0012 namespace boost {
0013 namespace nowide {
0014     namespace detail {
0015 
0016         /// Trait to heuristically check for a *\::filesystem::path
0017         /// Done by checking for make_preferred and filename member functions with correct signature
0018         template<typename T>
0019         struct is_path
0020         {
0021             template<typename U, U& (U::*)(), U (U::*)() const>
0022             struct Check;
0023             template<typename U>
0024             static std::true_type test(Check<U, &U::make_preferred, &U::filename>*);
0025             template<typename U>
0026             static std::false_type test(...);
0027 
0028             static constexpr bool value = decltype(test<T>(0))::value;
0029         };
0030         /// SFINAE trait which has a member "type = Result" if the Path is a *\::filesystem::path
0031         template<typename Path, typename Result>
0032         using enable_if_path_t = typename std::enable_if<is_path<Path>::value, Result>::type;
0033 
0034     } // namespace detail
0035 } // namespace nowide
0036 } // namespace boost
0037 
0038 #endif