00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PARSE_IDS_HH
00019 # define PARSE_IDS_HH
00020
00021 # include <vector>
00022 # include <tuple>
00023 # include <string>
00024 # include "../type_traits/always_false.hh"
00025
00026 namespace catsfoot {
00027
00028 namespace details {
00029
00031 template <typename T, typename... U, typename... V,
00032 typename = typename
00033 std::enable_if<sizeof...(V) == sizeof...(U)>::type>
00034 std::tuple<std::pair<T, U>...>
00035 zip_vec_tuple(const std::vector<T>& vec,
00036 const std::tuple<U...>&,
00037 V&&... v) {
00038 assert(vec.size() == sizeof...(V));
00039 return std::tuple<std::pair<T, U>...>{std::forward<V>(v)...};
00040 }
00041
00043 template <typename T, typename... U, typename... V,
00044 typename = void,
00045 typename
00046 # ifndef DOC_GEN
00047 = typename
00048 std::enable_if<sizeof...(V) < sizeof...(U)>::type
00049 # endif
00050 >
00051 std::tuple<std::pair<T, U>...>
00052 zip_vec_tuple(const std::vector<T>& v,
00053 const std::tuple<U...>& t,
00054 V&&... values) {
00055 return zip_vec_tuple
00056 (v, t, std::forward<V>(values)...,
00057 std::pair
00058 <T, typename std::tuple_element<sizeof...(V), std::tuple<U...> >
00059 ::type>
00060 {v[sizeof...(V)], std::get<sizeof...(V)>(t)});
00061 }
00062
00063 # ifdef __CATSFOOT_ENABLE_TESTING_RT
00064 # include "../extern_decl.hh"
00065
00068 EXTERN
00069 std::vector<std::string>
00070 split_identifiers(const std::string&);
00071 # else
00072 template <typename T = std::string>
00073 std::vector<std::string>
00074 split_identifiers(const T&) {
00075 static_assert(details::always_false<T>::value,
00076 "You probably called a functionality that is available "
00077 "only if you link with the runtime library. In this case "
00078 "include catsfoot_testing.hh instead of catsfoot.hh");
00079 return std::vector<std::string>{};
00080 }
00081 # endif
00082 }
00083 }
00084
00085 #endif