10 #ifndef WIRECELLUTIL_TUPLEHELPERS 11 #define WIRECELLUTIL_TUPLEHELPERS 13 #include <boost/any.hpp> 20 #include <type_traits> 30 #if __cplusplus <= 201103L 32 template <std::size_t... Is>
35 template <std::size_t
N, std::size_t... Is>
38 template <std::size_t... Is>
41 #endif // assume C++14 57 template <
typename Tuple>
61 template <
typename...>
class T,
70 template<
template <
typename...>
class Container >
72 typedef std::tuple<Container<Types>...>
type;
74 template<
template <
typename...>
class Container >
76 typedef std::tuple<Container<const Types>...>
type;
91 template<std::size_t... Indices>
93 return { boost::any(std::get<Indices>(t))... };
107 template<std::size_t... Indices>
109 return std::make_tuple(boost::any_cast<Types>(anyv[Indices])...);
128 template <
typename Tuple>
132 template <
typename...>
class T,
140 template<
template <
typename...>
class Container >
141 struct WrappedShared {
142 typedef std::tuple<Container< std::shared_ptr<const Types> >...>
type;
151 template<
typename Element>
153 return any_queue_type(in.begin(), in.end());
157 template<std::size_t... Indices>
160 return { as_any_queue_convert(std::get<Indices>(toq))... };
175 std::vector< any_queue_type >
as_any_queue(
const shared_queued_tuple_type& toq) {
182 template <
typename Type>
184 std::deque< std::shared_ptr<const Type> > ret;
186 ret.push_back(boost::any_cast< std::shared_ptr<const Type> >(
a));
192 template<std::size_t... Indices>
194 return std::make_tuple(from_any_queue_convert<Types>(vaq[Indices])...);
199 shared_queued_tuple_type
from_any_queue(
const std::vector< any_queue_type >& vaq) {
210 template <std::
size_t N,
typename T>
214 template <typename
T>
216 typedef decltype(std::tuple<>())
type;
tuple_type from_any_impl(const any_vector_type &anyv, std::index_sequence< Indices... >)
shared_queued_tuple_type from_any_queue_impl(const std::vector< any_queue_type > &vaq, std::index_sequence< Indices... >)
shared_queued_tuple_type from_any_queue(const std::vector< any_queue_type > &vaq)
WrappedShared< std::deque >::type shared_queued_tuple_type
any_vector_type as_any(const tuple_type &t)
std::tuple< Container< std::shared_ptr< const Types > >... > type
any_vector_type as_any_impl(const tuple_type &t, std::index_sequence< Indices... >)
std::vector< std::string > type_names()
std::vector< any_queue_type > as_any_queue(const shared_queued_tuple_type &toq)
std::tuple< Container< const Types >... > type
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
tuple_type from_any(const any_vector_type &anyv)
std::tuple< Container< Types >... > type
const GenericPointer< typename T::ValueType > T2 value
any_queue_type as_any_queue_convert(const std::deque< std::shared_ptr< const Element > > &in)
std::deque< std::shared_ptr< const Type > > from_any_queue_convert(const any_queue_type &aq)
std::vector< boost::any > any_vector_type
std::deque< boost::any > any_queue_type
std::vector< any_queue_type > as_any_queue_impl(const shared_queued_tuple_type &toq, std::index_sequence< Indices... >)