Standard library header <dynarray> - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <dynarray>

From cppreference.com
< cpp‎ | header

This header is part of the containers library.

### Includes
`<initializer_list>`
### Classes
dynarray (since C++14) | fixed-size contiguous array (class template) [edit]
std::uses_allocator<std::dynarray> (C++11) | specializes the std::uses_allocator type trait (function template) [edit]
### Functions
operator==operator!=operator<operator<=operator>operator>= | lexicographically compares the values in the dynarray (function template) [edit]

### [edit] Synopsis

    namespace std {

        template <class T> class dynarray;

        template <class Type, class Alloc>
        struct uses_allocator<dynarray<Type>, Alloc>;

        template <class T>
        bool operator==(const dynarray<T>& x, const dynarray<T>& y);
        template <class T>
        bool operator!=(const dynarray<T>& x, const dynarray<T>& y);

        template <class T>
        bool operator<(const dynarray<T>& x, const dynarray<T>& y);
        template <class T>
        bool operator>(const dynarray<T>& x, const dynarray<T>& y);
        template <class T>
        bool operator>=(const dynarray<T>& x, const dynarray<T>& y);
        template <class T>
        bool operator<=(const dynarray<T>& x, const dynarray<T>& y);
    }
    }

#### [edit] Class std::dynarray

    template <class T>
    class dynarray {
     public:
        // types:
        typedef T value_type;
        typedef T& reference;
        typedef const T& const_reference;
        typedef T* pointer;
        typedef const T* const_pointer;
        typedef /*implementation-defined*/ iterator;
        typedef /*implementation-defined*/ const_iterator;
        typedef reverse_iterator<iterator> reverse_iterator;
        typedef reverse_iterator<const_iterator> const_reverse_iterator;
        typedef size_t size_type;
        typedef ptrdiff_t difference_type;

        // construct/copy/destroy:
        explicit dynarray(size_type c);
        template <class Alloc> dynarray(size_type c, const Alloc& alloc);
        dynarray(size_type c, const T& v);
        template <class Alloc> dynarray(size_type c, const T& v, const Alloc& alloc);
        dynarray(const dynarray& d);
        template <class Alloc> dynarray(const dynarray& d, const Alloc& alloc);
        dynarray(initializer_list<T>);
        template <class Alloc> dynarray(initializer_list<T>, const Alloc& alloc);
        dynarray& operator=(const dynarray&) = delete;
        ~dynarray();

        // iterators:
        iterator begin() noexcept;
        const_iterator begin() const noexcept;
        const_iterator cbegin() const noexcept;
        iterator end() noexcept;
        const_iterator end() const noexcept;
        const_iterator cend() const noexcept;
        reverse_iterator rbegin() noexcept;
        const_reverse_iterator rbegin() const noexcept;
        const_reverse_iterator crbegin() const noexcept;
        reverse_iterator rend() noexcept;
        const_reverse_iterator rend() const noexcept;
        const_reverse_iterator crend() const noexcept;

        // capacity:
        size_type size() const noexcept;
        size_type max_size() const noexcept;
        bool empty() const noexcept;

        // element access:
        reference operator[](size_type n);
        const_reference operator[](size_type n) const;
        reference front();
        const_reference front() const;
        reference back();
        const_reference back() const;
        const_reference at(size_type n) const;
        reference at(size_type n);

        // data access:
        T* data() noexcept;
        const T* data() const noexcept;

        // mutating member functions:
        void fill(const T& v);
    };

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/dynarray&oldid=63993"