8 #ifndef SIG_UTIL_MANIPULATE_HPP
9 #define SIG_UTIL_MANIPULATE_HPP
11 #include "../helper/type_convert.hpp"
12 #include "../helper/container_helper.hpp"
36 template <
class T_,
class = std::allocator<T_>>
class CSeq = std::vector,
37 class S = std::string,
38 class TS = impl::string_t<S>
46 const uint mag = delimiter.size();
47 const uint length = src.size();
48 uint pos = 0, ppos = 0;
51 if (src[pos] == delimiter[0]){
54 for (uint d = 1; d < mag; ++d){
55 if (src[pos+d] != delimiter[d]){
62 if (pos - ppos > 0) result.push_back(src.substr(ppos, pos - ppos));
75 if (pos - ppos > 0)result.push_back(src.substr(ppos, pos - ppos));
83 template <
template <
class T_,
class = std::allocator<T_>>
class CSeq = std::vector >
85 char const*
const src,
86 char const*
const delimiter)
89 return split<CSeq>(std::string(src), std::string(delimiter));
95 template <
template <
class T_,
class = std::allocator<T_>>
class CSeq = std::vector >
97 wchar_t const*
const src,
98 wchar_t const*
const delimiter)
101 return split<CSeq>(std::wstring(src), std::wstring(delimiter));
108 template <
class It,
class S,
class OSS>
114 std::locale osstream_locale = std::locale(
""))
115 ->decltype(osstream.str())
117 if (begin == end)
return osstream.str();
119 std::locale::global(osstream_locale);
120 std::locale ctype_default(std::locale::classic(), osstream_locale, std::locale::ctype);
121 osstream.imbue(ctype_default);
123 for (osstream << *begin++; begin !=
end; ++
begin){
124 osstream << delimiter << *
begin;
127 return osstream.str();
152 class CR =
typename impl::remove_const_reference<C>::type,
153 class S =
typename impl::SStreamSelector<typename impl::container_traits<CR>::value_type>::string
158 std::locale osstream_locale = std::locale(
""))
176 template <class T, class S = typename impl::SStreamSelector<T>::string>
178 std::initializer_list<T> container,
180 std::locale osstream_locale = std::locale(
""))
auto split(S const &src, impl::string_t< S > const &delimiter) -> CSeq< TS >
文字列(src)をある文字列(delimiter)を目印に分割する
auto end(C &&c) -> std::move_iterator< typename RC::iterator >
auto cat(C &&container, typename sig::impl::identity< S >::type const &delimiter, std::locale osstream_locale=std::locale("")) -> S
コンテナ中の各文字列や数値を結合
auto cat_impl(It begin, It end, S const &delimiter, OSS &osstream, std::locale osstream_locale=std::locale("")) -> decltype(osstream.str())
std::ostringstream ostringstream
typename StringId< typename remove_const_reference< typename std::decay< T >::type >::type >::type string_t
auto begin(C &&c) -> std::move_iterator< typename RC::iterator >