Revert "[vector] Add initializer_list constructor & tests"
This reverts commit aa6182453b
.
This commit is contained in:
parent
aa6182453b
commit
c484641304
|
@ -31,8 +31,6 @@
|
||||||
#include "hb-array.hh"
|
#include "hb-array.hh"
|
||||||
#include "hb-null.hh"
|
#include "hb-null.hh"
|
||||||
|
|
||||||
#include <initializer_list>
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct hb_vector_t
|
struct hb_vector_t
|
||||||
|
@ -41,14 +39,9 @@ struct hb_vector_t
|
||||||
static constexpr unsigned item_size = hb_static_size (Type);
|
static constexpr unsigned item_size = hb_static_size (Type);
|
||||||
|
|
||||||
hb_vector_t () { init (); }
|
hb_vector_t () { init (); }
|
||||||
hb_vector_t (std::initializer_list<Type> l) : hb_vector_t ()
|
hb_vector_t (const hb_vector_t &o)
|
||||||
{
|
|
||||||
alloc (l.size ());
|
|
||||||
for (auto&& i : l)
|
|
||||||
push (i);
|
|
||||||
}
|
|
||||||
hb_vector_t (const hb_vector_t &o) : hb_vector_t ()
|
|
||||||
{
|
{
|
||||||
|
init ();
|
||||||
alloc (o.length);
|
alloc (o.length);
|
||||||
hb_copy (o, *this);
|
hb_copy (o, *this);
|
||||||
}
|
}
|
||||||
|
@ -309,10 +302,6 @@ struct hb_vector_t
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct hb_sorted_vector_t : hb_vector_t<Type>
|
struct hb_sorted_vector_t : hb_vector_t<Type>
|
||||||
{
|
{
|
||||||
hb_sorted_vector_t () : hb_vector_t<Type> () {}
|
|
||||||
hb_sorted_vector_t (std::initializer_list<Type> l) : hb_vector_t<Type> (l) {}
|
|
||||||
hb_sorted_vector_t (hb_sorted_vector_t& o) : hb_vector_t<Type> (o) {}
|
|
||||||
|
|
||||||
hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->length); }
|
hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->length); }
|
||||||
hb_sorted_array_t<const Type> as_array () const { return hb_sorted_array (this->arrayZ, this->length); }
|
hb_sorted_array_t<const Type> as_array () const { return hb_sorted_array (this->arrayZ, this->length); }
|
||||||
|
|
||||||
|
|
|
@ -91,25 +91,5 @@ main (int argc, char **argv)
|
||||||
assert (++hb_inc (x) == 3);
|
assert (++hb_inc (x) == 3);
|
||||||
assert (x == 3);
|
assert (x == 3);
|
||||||
|
|
||||||
{
|
|
||||||
hb_vector_t<int> v1 {1, 2, 3};
|
|
||||||
hb_vector_t<int> v2 {4, 5};
|
|
||||||
hb_swap (v1, v2);
|
|
||||||
assert (v1.length == 2);
|
|
||||||
assert (v1[0] == 4);
|
|
||||||
assert (v2.length == 3);
|
|
||||||
assert (v2[2] == 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
hb_sorted_vector_t<int> v1 {1, 2, 3};
|
|
||||||
hb_sorted_vector_t<int> v2 {4, 5};
|
|
||||||
hb_swap (v1, v2);
|
|
||||||
assert (v1.length == 2);
|
|
||||||
assert (v1[0] == 4);
|
|
||||||
assert (v2.length == 3);
|
|
||||||
assert (v2[2] == 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue