1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
template<typename T, typename alloc = std::allocator<T>>
class val_array
{
array_base<T, alloc> base;
public:
val_array(std::size_t sz, T val = {});
val_array(std::initializer_list<T>);
val_array(const val_array&);
val_array& operator=(const val_array&);
val_array(val_array&&);
val_array& operator=(val_array&&);
unsigned size() const { return base.size; }
T& operator[](std::size_t sz);
const T& operator[](std::size_t sz) const;
template<typename U, typename A>
val_array<std::common_type_t<T, U>, common_allocator<T, U, alloc, A>> operator+(const val_array<U, A>& v) const;
template<typename U>
val_array<std::common_type_t<T, U>, get_allocator<T,U,alloc>> operator+(U val) const;
template<typename U, typename A>
val_array<std::common_type_t<T, U>, common_allocator<T, U, alloc, A>> operator*(const val_array<U,A>& v) const;
template<typename U>
val_array<std::common_type_t<T, U>, get_allocator<T, U, alloc>> operator*(U val) const;
~val_array() { base.destroy(); }
};
|