整理
This commit is contained in:
32
include/boost/process/v1/detail/traits/async.hpp
Normal file
32
include/boost/process/v1/detail/traits/async.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_ASYNC_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_ASYNC_HPP_
|
||||
|
||||
#include <boost/process/v1/detail/config.hpp>
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
|
||||
namespace boost { namespace asio {
|
||||
|
||||
class io_context;
|
||||
}}
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
|
||||
|
||||
struct async_tag {};
|
||||
|
||||
template<>
|
||||
struct initializer_builder<async_tag>;
|
||||
|
||||
template<> struct initializer_tag<::boost::asio::io_context> { typedef async_tag type;};
|
||||
|
||||
|
||||
|
||||
|
||||
}}}}
|
||||
|
||||
#endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */
|
||||
85
include/boost/process/v1/detail/traits/cmd_or_exe.hpp
Normal file
85
include/boost/process/v1/detail/traits/cmd_or_exe.hpp
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_CMD_OR_EXE_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_CMD_OR_EXE_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <type_traits>
|
||||
#include <initializer_list>
|
||||
#include <boost/process/v1/filesystem.hpp>
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
|
||||
|
||||
template<typename Char>
|
||||
struct cmd_or_exe_tag {};
|
||||
|
||||
struct shell_;
|
||||
|
||||
|
||||
template<> struct initializer_tag<const char* > { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<const wchar_t* > { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<char* > { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<wchar_t* > { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<std::size_t Size> struct initializer_tag<const char [Size]> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<std::size_t Size> struct initializer_tag<const wchar_t [Size]> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<std::size_t Size> struct initializer_tag<const char (&)[Size]> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<std::size_t Size> struct initializer_tag<const wchar_t (&)[Size]> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::basic_string<char >> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::basic_string<wchar_t >> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::vector<std::basic_string<char >>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::vector<std::basic_string<wchar_t >>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::initializer_list<std::basic_string<char >>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::initializer_list<std::basic_string<wchar_t >>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::vector<char *>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::vector<wchar_t *>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::initializer_list<char *>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::initializer_list<wchar_t *>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<std::initializer_list<const char *>> { typedef cmd_or_exe_tag<char> type;};
|
||||
template<> struct initializer_tag<std::initializer_list<const wchar_t *>> { typedef cmd_or_exe_tag<wchar_t> type;};
|
||||
|
||||
template<> struct initializer_tag<shell_>
|
||||
{
|
||||
typedef cmd_or_exe_tag<typename boost::process::v1::filesystem::path::value_type> type;
|
||||
};
|
||||
|
||||
template<> struct initializer_tag<boost::process::v1::filesystem::path>
|
||||
{
|
||||
typedef cmd_or_exe_tag<typename boost::process::v1::filesystem::path::value_type> type;
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
struct exe_setter_;
|
||||
template <typename Char, bool Append = false>
|
||||
struct arg_setter_;
|
||||
|
||||
template <typename Char, bool Append>
|
||||
struct initializer_tag<arg_setter_<Char, Append>> { typedef cmd_or_exe_tag<Char> type;};
|
||||
|
||||
template<typename Char> struct initializer_tag<exe_setter_<Char>> { typedef cmd_or_exe_tag<Char> type;};
|
||||
|
||||
template<>
|
||||
struct initializer_builder<cmd_or_exe_tag<char>>;
|
||||
|
||||
template<>
|
||||
struct initializer_builder<cmd_or_exe_tag<wchar_t>>;
|
||||
|
||||
|
||||
}}}}
|
||||
|
||||
#endif /* BOOST_PROCESS_DETAIL_STRING_TRAITS_HPP_ */
|
||||
74
include/boost/process/v1/detail/traits/decl.hpp
Normal file
74
include/boost/process/v1/detail/traits/decl.hpp
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_DECL_HPP_
|
||||
|
||||
#include <boost/process/v1/detail/config.hpp>
|
||||
#include <boost/none.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
#if defined(BOOST_POSIX_API)
|
||||
#include <boost/process/v1/detail/posix/handler.hpp>
|
||||
#elif defined(BOOST_WINDOWS_API)
|
||||
#include <boost/process/v1/detail/windows/handler.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct is_initializer : std::is_base_of<handler_base, T> {};
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct is_initializer<T&> : std::is_base_of<handler_base, T> {};
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct initializer_tag;// { typedef void type; };
|
||||
|
||||
|
||||
//remove const
|
||||
template<typename T>
|
||||
struct initializer_tag<const T> { typedef typename initializer_tag<T>::type type; };
|
||||
|
||||
//remove &
|
||||
template<typename T>
|
||||
struct initializer_tag<T&> { typedef typename initializer_tag<T>::type type; };
|
||||
|
||||
//remove const &
|
||||
template<typename T>
|
||||
struct initializer_tag<const T&> { typedef typename initializer_tag<T>::type type; };
|
||||
|
||||
template<typename T>
|
||||
struct initializer_builder;
|
||||
|
||||
|
||||
template<typename First, typename ...Args>
|
||||
struct valid_argument_list;
|
||||
|
||||
template<typename First>
|
||||
struct valid_argument_list<First>
|
||||
{
|
||||
constexpr static bool value = is_initializer<First>::value || !std::is_void<typename initializer_tag<First>::type>::value;
|
||||
typedef std::integral_constant<bool, value> type;
|
||||
};
|
||||
|
||||
template<typename First, typename ...Args>
|
||||
struct valid_argument_list
|
||||
{
|
||||
constexpr static bool my_value = is_initializer<First>::value || !std::is_void<typename initializer_tag<First>::type>::value;
|
||||
constexpr static bool value = valid_argument_list<Args...>::value && my_value;
|
||||
typedef std::integral_constant<bool, value> type;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}}}}
|
||||
|
||||
#endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */
|
||||
48
include/boost/process/v1/detail/traits/env.hpp
Normal file
48
include/boost/process/v1/detail/traits/env.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_ENV_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_ENV_HPP_
|
||||
|
||||
#include <boost/process/v1/detail/config.hpp>
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 {
|
||||
|
||||
template<typename Char>
|
||||
class basic_environment;
|
||||
|
||||
template<typename Char>
|
||||
class basic_native_environment;
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<typename Char>
|
||||
struct env_tag {};
|
||||
|
||||
template<typename Char> struct env_set;
|
||||
template<typename Char> struct env_append;
|
||||
|
||||
template<typename Char> struct env_reset;
|
||||
template<typename Char> struct env_init;
|
||||
|
||||
|
||||
template<typename Char> struct initializer_tag<env_set<Char>> { typedef env_tag<Char> type; };
|
||||
template<typename Char> struct initializer_tag<env_append<Char>> { typedef env_tag<Char> type; };
|
||||
|
||||
template<typename Char> struct initializer_tag<env_reset<Char>> { typedef env_tag<Char> type;};
|
||||
template<typename Char> struct initializer_tag<env_init <Char>> { typedef env_tag<Char> type;};
|
||||
|
||||
template<typename Char> struct initializer_tag<::boost::process::v1::basic_environment<Char>> { typedef env_tag<Char> type; };
|
||||
template<typename Char> struct initializer_tag<::boost::process::v1::basic_native_environment<Char>> { typedef env_tag<Char> type; };
|
||||
|
||||
template<> struct initializer_builder<env_tag<char>>;
|
||||
template<> struct initializer_builder<env_tag<wchar_t>>;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}}}
|
||||
#endif /* INCLUDE_BOOST_PROCESS_DETAIL_ENV_HPP_ */
|
||||
25
include/boost/process/v1/detail/traits/error.hpp
Normal file
25
include/boost/process/v1/detail/traits/error.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_ERROR_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_ERROR_HPP_
|
||||
|
||||
#include <boost/process/v1/detail/config.hpp>
|
||||
#include <system_error>
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
|
||||
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
|
||||
|
||||
struct error_tag;
|
||||
|
||||
template<>
|
||||
struct initializer_tag<std::error_code>;
|
||||
|
||||
}}}}
|
||||
|
||||
#endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */
|
||||
37
include/boost/process/v1/detail/traits/group.hpp
Normal file
37
include/boost/process/v1/detail/traits/group.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_GROUP_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_GROUP_HPP_
|
||||
|
||||
#include <boost/process/v1/detail/config.hpp>
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
|
||||
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 {
|
||||
|
||||
struct group;
|
||||
|
||||
namespace detail {
|
||||
|
||||
|
||||
struct group_tag {};
|
||||
|
||||
template<>
|
||||
struct make_initializer_t<group_tag>;
|
||||
|
||||
|
||||
template<> struct initializer_tag_t<::boost::process::v1::group> { typedef group_tag type;};
|
||||
|
||||
|
||||
|
||||
|
||||
}}}}
|
||||
|
||||
|
||||
|
||||
#endif /* BOOST_PROCESS_DETAIL_HANDLER_HPP_ */
|
||||
276
include/boost/process/v1/detail/traits/wchar_t.hpp
Normal file
276
include/boost/process/v1/detail/traits/wchar_t.hpp
Normal file
@@ -0,0 +1,276 @@
|
||||
// Copyright (c) 2016 Klemens D. Morgenstern
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
#ifndef BOOST_PROCESS_DETAIL_TRAITS_WCHAR_T_HPP_
|
||||
#define BOOST_PROCESS_DETAIL_TRAITS_WCHAR_T_HPP_
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/process/v1/detail/traits/decl.hpp>
|
||||
#include <boost/process/v1/detail/traits/cmd_or_exe.hpp>
|
||||
#include <boost/process/v1/detail/traits/env.hpp>
|
||||
#include <boost/process/v1/locale.hpp>
|
||||
|
||||
namespace boost { namespace process { BOOST_PROCESS_V1_INLINE namespace v1 { namespace detail {
|
||||
|
||||
//template
|
||||
|
||||
template<typename T> struct is_wchar_t : std::false_type {};
|
||||
|
||||
template<> struct is_wchar_t<boost::process::v1::filesystem::path> : std::is_same<typename boost::process::v1::filesystem::path::value_type, wchar_t>
|
||||
{
|
||||
};
|
||||
|
||||
template<> struct is_wchar_t<const wchar_t* > : std::true_type {};
|
||||
|
||||
template<> struct is_wchar_t<wchar_t* > : std::true_type {};
|
||||
|
||||
template<std::size_t Size> struct is_wchar_t<const wchar_t [Size]> : std::true_type {};
|
||||
template<std::size_t Size> struct is_wchar_t<const wchar_t (&)[Size]> : std::true_type {};
|
||||
|
||||
template<> struct is_wchar_t<std::wstring> : std::true_type {};
|
||||
template<> struct is_wchar_t<std::vector<std::wstring>> : std::true_type {};
|
||||
template<> struct is_wchar_t<std::initializer_list<std::wstring>> : std::true_type {};
|
||||
template<> struct is_wchar_t<std::vector<wchar_t *>> : std::true_type {};
|
||||
template<> struct is_wchar_t<std::initializer_list<wchar_t *>> : std::true_type {};
|
||||
|
||||
|
||||
|
||||
template<typename Char, typename T>
|
||||
struct char_converter
|
||||
{
|
||||
static T& conv(T & in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
static T&& conv(T&& in)
|
||||
{
|
||||
return std::move(in);
|
||||
}
|
||||
static const T& conv(const T & in)
|
||||
{
|
||||
return in;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Char, typename T>
|
||||
using char_converter_t = char_converter<Char,
|
||||
typename std::remove_cv<typename std::remove_reference<T>::type>::type>;
|
||||
|
||||
|
||||
template<>
|
||||
struct char_converter<char, const wchar_t*>
|
||||
{
|
||||
static std::string conv(const wchar_t* in)
|
||||
{
|
||||
std::size_t size = 0;
|
||||
while (in[size] != L'\0') size++;
|
||||
return ::boost::process::v1::detail::convert(in, in + size);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, wchar_t*>
|
||||
{
|
||||
static std::string conv(wchar_t* in)
|
||||
{
|
||||
std::size_t size = 0;
|
||||
while (in[size] != L'\0') size++;
|
||||
return ::boost::process::v1::detail::convert(in, in + size);
|
||||
}
|
||||
};
|
||||
|
||||
template<std::size_t Size>
|
||||
struct char_converter<char, wchar_t[Size]>
|
||||
{
|
||||
static std::string conv(const wchar_t(&in)[Size])
|
||||
{
|
||||
return ::boost::process::v1::detail::convert(in, in + Size -1);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, const char*>
|
||||
{
|
||||
static std::wstring conv(const char* in)
|
||||
{
|
||||
std::size_t size = 0;
|
||||
while (in[size] != '\0') size++;
|
||||
return ::boost::process::v1::detail::convert(in, in + size);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, char*>
|
||||
{
|
||||
static std::wstring conv(char* in)
|
||||
{
|
||||
std::size_t size = 0;
|
||||
while (in[size] != '\0') size++;
|
||||
return ::boost::process::v1::detail::convert(in, in + size);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<std::size_t Size>
|
||||
struct char_converter<wchar_t, char[Size]>
|
||||
{
|
||||
static std::wstring conv(const char(&in)[Size])
|
||||
{
|
||||
return ::boost::process::v1::detail::convert(in, in + Size -1);
|
||||
}
|
||||
};
|
||||
|
||||
//all the containers.
|
||||
template<>
|
||||
struct char_converter<wchar_t, std::string>
|
||||
{
|
||||
static std::wstring conv(const std::string & in)
|
||||
{
|
||||
return ::boost::process::v1::detail::convert(in);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, std::wstring>
|
||||
{
|
||||
static std::string conv(const std::wstring & in)
|
||||
{
|
||||
return ::boost::process::v1::detail::convert(in);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, std::vector<std::string>>
|
||||
{
|
||||
static std::vector<std::wstring> conv(const std::vector<std::string> & in)
|
||||
{
|
||||
std::vector<std::wstring> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const std::string & st)
|
||||
{
|
||||
return convert(st);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, std::initializer_list<std::string>>
|
||||
{
|
||||
static std::vector<std::wstring> conv(const std::initializer_list<std::string> & in)
|
||||
{
|
||||
std::vector<std::wstring> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const std::string & st)
|
||||
{
|
||||
return convert(st);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, std::vector<char* >>
|
||||
{
|
||||
static std::vector<std::wstring> conv(const std::vector<char* > & in)
|
||||
{
|
||||
std::vector<std::wstring> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const char* st)
|
||||
{
|
||||
std::size_t sz = 0;
|
||||
while (st[sz] != '\0') sz++;
|
||||
return convert(st, st + sz);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<wchar_t, std::initializer_list<char *>>
|
||||
{
|
||||
static std::vector<std::wstring> conv(const std::initializer_list<char * > & in)
|
||||
{
|
||||
std::vector<std::wstring> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const char* st)
|
||||
{
|
||||
std::size_t sz = 0;
|
||||
while (st[sz] != '\0') sz++;
|
||||
return convert(st, st + sz);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, std::vector<std::wstring>>
|
||||
{
|
||||
static std::vector<std::string> conv(const std::vector<std::wstring> & in)
|
||||
{
|
||||
std::vector<std::string> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const std::wstring & st)
|
||||
{
|
||||
return convert(st);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, std::initializer_list<std::wstring>>
|
||||
{
|
||||
static std::vector<std::string> conv(const std::initializer_list<std::wstring> & in)
|
||||
{
|
||||
std::vector<std::string> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const std::wstring & st)
|
||||
{
|
||||
return convert(st);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, std::vector<wchar_t* >>
|
||||
{
|
||||
static std::vector<std::string> conv(const std::vector<wchar_t* > & in)
|
||||
{
|
||||
std::vector<std::string> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const wchar_t* st)
|
||||
{
|
||||
std::size_t sz = 0;
|
||||
while (st[sz] != L'\0') sz++;
|
||||
return convert(st, st + sz);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct char_converter<char, std::initializer_list<wchar_t * >>
|
||||
{
|
||||
static std::vector<std::string> conv(const std::initializer_list<wchar_t *> & in)
|
||||
{
|
||||
std::vector<std::string> ret(in.size());
|
||||
std::transform(in.begin(), in.end(), ret.begin(),
|
||||
[](const wchar_t* st)
|
||||
{
|
||||
std::size_t sz = 0;
|
||||
while (st[sz] != L'\0') sz++;
|
||||
return convert(st, st + sz);
|
||||
});
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}}}}
|
||||
#endif /* BOOST_PROCESS_DETAIL_TRAITS_WCHAR_T_HPP_ */
|
||||
Reference in New Issue
Block a user