Boost.Nowide
is_path.hpp
1//
2// Copyright (c) 2020 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_NOWIDE_DETAIL_IS_PATH_HPP_INCLUDED
8#define BOOST_NOWIDE_DETAIL_IS_PATH_HPP_INCLUDED
9
10#include <type_traits>
11
12namespace boost {
13namespace nowide {
14 namespace detail {
15
18 template<typename T>
19 struct is_path
20 {
21 template<typename U, U& (U::*)(), U (U::*)() const>
22 struct Check;
23 template<typename U>
24 static std::true_type test(Check<U, &U::make_preferred, &U::filename>*);
25 template<typename U>
26 static std::false_type test(...);
27
28 static constexpr bool value = decltype(test<T>(0))::value;
29 };
31 template<typename Path, typename Result>
32 using enable_if_path_t = typename std::enable_if<is_path<Path>::value, Result>::type;
33
34 } // namespace detail
35} // namespace nowide
36} // namespace boost
37
38#endif