Commit 951b12cf authored by Dominik Charousset's avatar Dominik Charousset

fixed forwarding during tuple creation

parent edd57563
...@@ -89,25 +89,12 @@ class cow_tuple { ...@@ -89,25 +89,12 @@ class cow_tuple {
static constexpr size_t num_elements = sizeof...(ElementTypes); static constexpr size_t num_elements = sizeof...(ElementTypes);
/**
* @brief Initializes each element with its default constructor.
*/
cow_tuple() : m_vals(new data_type) {
}
/** /**
* @brief Initializes the cow_tuple with @p args. * @brief Initializes the cow_tuple with @p args.
* @param args Initialization values. * @param args Initialization values.
*/ */
cow_tuple(const ElementTypes&... args) : m_vals(new data_type(args...)) { template<typename... Args>
} cow_tuple(Args&&... args) : m_vals(new data_type(std::forward<Args>(args)...)) { }
/**
* @brief Initializes the cow_tuple with @p args.
* @param args Initialization values.
*/
cow_tuple(ElementTypes&&... args) : m_vals(new data_type(std::move(args)...)) {
}
cow_tuple(cow_tuple&&) = default; cow_tuple(cow_tuple&&) = default;
cow_tuple(const cow_tuple&) = default; cow_tuple(const cow_tuple&) = default;
......
...@@ -200,8 +200,7 @@ struct td_filter_<true, false, Head, T> { ...@@ -200,8 +200,7 @@ struct td_filter_<true, false, Head, T> {
}; };
template<typename Head, typename T> template<typename Head, typename T>
struct td_filter_<true, true, Head, T> : td_filter_<true, false, Head, T> { struct td_filter_<true, true, Head, T> : td_filter_<true, false, Head, T> { };
};
template<typename Head, typename T> template<typename Head, typename T>
auto td_filter(T&& arg) auto td_filter(T&& arg)
...@@ -248,7 +247,10 @@ struct tdata<Head, Tail...> : tdata<Tail...> { ...@@ -248,7 +247,10 @@ struct tdata<Head, Tail...> : tdata<Tail...> {
inline tdata() : super(), head() { } inline tdata() : super(), head() { }
tdata(Head arg) : super(), head(std::move(arg)) { } //tdata(Head arg) : super(), head(std::move(arg)) { }
tdata(const Head& arg) : super(), head(arg) { }
tdata(Head&& arg) : super(), head(std::move(arg)) { }
template<typename Arg0, typename Arg1, typename... Args> template<typename Arg0, typename Arg1, typename... Args>
tdata(Arg0&& arg0, Arg1&& arg1, Args&&... args) tdata(Arg0&& arg0, Arg1&& arg1, Args&&... args)
......
...@@ -56,13 +56,12 @@ class tuple_vals : public abstract_tuple { ...@@ -56,13 +56,12 @@ class tuple_vals : public abstract_tuple {
typedef types_array<ElementTypes...> element_types; typedef types_array<ElementTypes...> element_types;
tuple_vals() : super(tuple_impl_info::statically_typed), m_data() { }
tuple_vals(const tuple_vals&) = default; tuple_vals(const tuple_vals&) = default;
tuple_vals(const ElementTypes&... args) template<typename... Args>
: super(tuple_impl_info::statically_typed), m_data(args...) { tuple_vals(Args&&... args)
} : super(tuple_impl_info::statically_typed)
, m_data(std::forward<Args>(args)...) { }
const void* native_data() const { const void* native_data() const {
return &m_data; return &m_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment