Commit b268c0cc authored by Quentin Khan's avatar Quentin Khan

Add a few static asserts to variadic_container

parent 187db7b0
......@@ -911,7 +911,7 @@ private:
/** \brief Implements the insert algorithm for value movement or copy
*
* \tparam ValueTuple a tuple type of values or references
* \tparam Values a pack of values or references
*
* \param pos Position before which to insert the values
* \param count Number of copies to insert
......@@ -955,6 +955,8 @@ public:
*/
template <typename ValueTuple>
iterator insert(const_iterator pos, ValueTuple&& values) {
static_assert(std::tuple_size<std::decay_t<ValueTuple>>::value == sizeof...(Indices),
"Given tuple does not have the right size");
return insert_impl(pos, 1, std::get<Indices>(std::forward<ValueTuple>(values))...);
}
......@@ -970,6 +972,8 @@ public:
*/
template <typename ValueTuple>
iterator insert(const_iterator pos, size_type count, ValueTuple&& values) {
static_assert(std::tuple_size<std::decay_t<ValueTuple>>::value == sizeof...(Indices),
"Given tuple does not have the right size");
return insert_impl(pos, count, std::get<Indices>(std::forward<ValueTuple>(values))...);
}
......@@ -1166,6 +1170,9 @@ public:
*/
template<typename... Args>
void push_back(const std::tuple<Args...>& values) {
static_assert(sizeof...(Args) == sizeof...(Indices),
"Given tuple does not have the right size");
this->insert(this->end(), values);
}
......@@ -1203,7 +1210,7 @@ public:
* \param count New container size
*/
void resize(size_type count) {
this->resize(count, value_type() );
this->resize(count, value_type{} );
}
......
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