1 // Copyright (c) 2016 Klemens D. Morgenstern
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 
7 #ifndef BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
8 #define BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
9 
10 #include <boost/process/detail/config.hpp>
11 #include <boost/none.hpp>
12 #include <type_traits>
13 
14 #if defined(BOOST_POSIX_API)
15 #include <boost/process/detail/posix/handler.hpp>
16 #elif defined(BOOST_WINDOWS_API)
17 #include <boost/process/detail/windows/handler.hpp>
18 #endif
19 
20 
21 namespace boost { namespace process { namespace detail {
22 
23 
24 template<typename T>
25 struct is_initializer : std::is_base_of<handler_base, T> {};
26 
27 
28 template<typename T>
29 struct is_initializer<T&> : std::is_base_of<handler_base, T> {};
30 
31 
32 template<typename T>
33 struct initializer_tag;// { typedef void type; };
34 
35 
36 //remove const
37 template<typename T>
38 struct initializer_tag<const T> { typedef typename initializer_tag<T>::type type; };
39 
40 //remove &
41 template<typename T>
42 struct initializer_tag<T&> { typedef typename initializer_tag<T>::type type; };
43 
44 //remove const &
45 template<typename T>
46 struct initializer_tag<const T&> { typedef typename initializer_tag<T>::type type; };
47 
48 template<typename T>
49 struct initializer_builder;
50 
51 
52 template<typename First, typename ...Args>
53 struct valid_argument_list;
54 
55 template<typename First>
56 struct valid_argument_list<First>
57 {
58     constexpr static bool value = is_initializer<First>::value || !std::is_void<typename initializer_tag<First>::type>::value;
59     typedef std::integral_constant<bool, value> type;
60 };
61 
62 template<typename First, typename ...Args>
63 struct valid_argument_list
64 {
65     constexpr static bool my_value = is_initializer<First>::value || !std::is_void<typename initializer_tag<First>::type>::value;
66     constexpr static bool value = valid_argument_list<Args...>::value && my_value;
67     typedef std::integral_constant<bool, value> type;
68 };
69 
70 
71 
72 }}}
73 
74 
75 
76 #endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */
77