[libcxx] r194614 - Move <dynarray> into include/experimental, and into the std::experimental namespace, since it's not part of C++14, but of an upcoming TS

Marshall Clow mclow.lists at gmail.com
Wed Nov 13 14:44:48 PST 2013


Author: marshall
Date: Wed Nov 13 16:44:48 2013
New Revision: 194614

URL: http://llvm.org/viewvc/llvm-project?rev=194614&view=rev
Log:
Move <dynarray> into include/experimental, and into the std::experimental namespace, since it's not part of C++14, but of an upcoming TS

Added:
    libcxx/trunk/include/experimental/dynarray
Removed:
    libcxx/trunk/include/dynarray
Modified:
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.data/default.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
    libcxx/trunk/test/containers/sequences/dynarray/dynarray.zero/default.pass.cpp

Removed: libcxx/trunk/include/dynarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/dynarray?rev=194613&view=auto
==============================================================================
--- libcxx/trunk/include/dynarray (original)
+++ libcxx/trunk/include/dynarray (removed)
@@ -1,311 +0,0 @@
-// -*- C++ -*-
-//===-------------------------- dynarray ----------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_DYNARRAY
-#define _LIBCPP_DYNARRAY
-
-#include <__config>
-#if _LIBCPP_STD_VER > 11
-
-/*
-    dynarray synopsis
-
-namespace std {
-
-template< typename T >
-class dynarray
-{
-    // 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;
-
-public:
-    // construct/copy/destroy:
-    explicit dynarray(size_type c);
-    template <typename Alloc>
-      dynarray(size_type c, const Alloc& alloc);
-    dynarray(size_type c, const T& v);
-    template <typename Alloc>
-      dynarray(size_type c, const T& v, const Alloc& alloc);
-    dynarray(const dynarray& d);
-    template <typename Alloc>
-      dynarray(const dynarray& d, const Alloc& alloc);
-    dynarray(initializer_list<T>);
-    template <typename 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);
-};
-
-}  // std
-
-*/
-
-#include <__functional_base>
-#include <iterator>
-#include <stdexcept>
-#include <initializer_list>
-#include <new>
-#include <algorithm>
-
-#if defined(_LIBCPP_NO_EXCEPTIONS)
-    #include <cassert>
-#endif
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-template <class _Tp>
-struct _LIBCPP_TYPE_VIS_ONLY dynarray
-{
-public:
-    // types:
-    typedef dynarray __self;
-    typedef _Tp                                   value_type;
-    typedef value_type&                           reference;
-    typedef const value_type&                     const_reference;
-    typedef value_type*                           iterator;
-    typedef const value_type*                     const_iterator;
-    typedef value_type*                           pointer;
-    typedef const value_type*                     const_pointer;
-    typedef size_t                                size_type;
-    typedef ptrdiff_t                             difference_type;
-    typedef std::reverse_iterator<iterator>       reverse_iterator;
-    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
-private:
-    size_t                  __size_;
-    value_type *            __base_;
-    _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
-    
-    static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
-    {
-        if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
-        {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-            throw bad_array_length();
-#else
-            assert(!"dynarray::allocation");
-#endif
-        }
-        return static_cast<value_type *> (::operator new (sizeof(value_type) * count));
-    }
-
-    static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
-    {
-        ::operator delete (static_cast<void *> (__ptr));
-    }
-
-public:
-
-    explicit dynarray(size_type __c);
-    dynarray(size_type __c, const value_type& __v);
-    dynarray(const dynarray& __d);
-    dynarray(initializer_list<value_type>);
-
-//  We're not implementing these right now.
-//  Waiting for the resolution of LWG issue #2235
-//     template <typename _Alloc>
-//       dynarray(size_type __c, const _Alloc& __alloc);
-//     template <typename _Alloc>
-//       dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
-//     template <typename _Alloc>
-//       dynarray(const dynarray& __d, const _Alloc& __alloc);
-//     template <typename _Alloc>
-//       dynarray(initializer_list<value_type>, const _Alloc& __alloc);
-
-    dynarray& operator=(const dynarray&) = delete;
-    ~dynarray();
-
-    // iterators:
-    inline _LIBCPP_INLINE_VISIBILITY iterator       begin()        noexcept { return iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator begin()  const noexcept { return const_iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
-    inline _LIBCPP_INLINE_VISIBILITY iterator       end()          noexcept { return iterator(data() + __size_); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator end()    const noexcept { return const_iterator(data() + __size_); }
-    inline _LIBCPP_INLINE_VISIBILITY const_iterator cend()   const noexcept { return const_iterator(data() + __size_); }
-
-    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rbegin()        noexcept { return reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin()  const noexcept { return const_reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
-    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rend()          noexcept { return reverse_iterator(begin()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend()    const noexcept { return const_reverse_iterator(begin()); }
-    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend()   const noexcept { return const_reverse_iterator(begin()); }
-
-    // capacity:
-    inline _LIBCPP_INLINE_VISIBILITY size_type size()     const noexcept { return __size_; }
-    inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
-    inline _LIBCPP_INLINE_VISIBILITY bool      empty()    const noexcept { return __size_ == 0; }
-
-    // element access:
-    inline _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n)       { return data()[__n]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
-
-    inline _LIBCPP_INLINE_VISIBILITY reference       front()       { return data()[0]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
-    inline _LIBCPP_INLINE_VISIBILITY reference       back()        { return data()[__size_-1]; }
-    inline _LIBCPP_INLINE_VISIBILITY const_reference back()  const { return data()[__size_-1]; }
-
-    inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
-    inline _LIBCPP_INLINE_VISIBILITY reference       at(size_type __n);
-
-    // data access:
-    inline _LIBCPP_INLINE_VISIBILITY _Tp*       data()       noexcept { return __base_; }
-    inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
-
-    // mutating member functions:
-    inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
-};
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
-{
-    __base_ = __allocate (__c);
-    value_type *__data = data ();
-    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
-        ::new (__data) value_type;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
-{
-    __base_ = __allocate (__c);
-    value_type *__data = data ();
-    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
-        ::new (__data) value_type (__v);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
-{
-    size_t sz = __il.size();
-    __base_ = __allocate (sz);
-    value_type *__data = data ();
-    auto src = __il.begin();
-    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
-        ::new (__data) value_type (*src);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
-{
-    size_t sz = __d.size();
-    __base_ = __allocate (sz);
-    value_type *__data = data ();
-    auto src = __d.begin();
-    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
-        ::new (__data) value_type (*src);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-dynarray<_Tp>::~dynarray()
-{ 
-    value_type *__data = data () + __size_;
-    for ( size_t i = 0; i < __size_; ++i )
-        (--__data)->value_type::~value_type();
-    __deallocate ( __base_ );
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename dynarray<_Tp>::reference
-dynarray<_Tp>::at(size_type __n)
-{
-    if (__n >= __size_)
-    {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-        throw out_of_range("dynarray::at");
-#else
-        assert(!"dynarray::at out_of_range");
-#endif
-    }
-    return data()[__n];
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-typename dynarray<_Tp>::const_reference
-dynarray<_Tp>::at(size_type __n) const
-{
-    if (__n >= __size_)
-    {
-#ifndef _LIBCPP_NO_EXCEPTIONS
-        throw out_of_range("dynarray::at");
-#else
-        assert(!"dynarray::at out_of_range");
-#endif
-    }
-    return data()[__n];
-}
-
-template <class _Tp, class _Alloc>
-struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<dynarray<_Tp>, _Alloc> : true_type {};
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif  // if _LIBCPP_STD_VER > 11 
-#endif  // _LIBCPP_DYNARRAY

Added: libcxx/trunk/include/experimental/dynarray
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/dynarray?rev=194614&view=auto
==============================================================================
--- libcxx/trunk/include/experimental/dynarray (added)
+++ libcxx/trunk/include/experimental/dynarray Wed Nov 13 16:44:48 2013
@@ -0,0 +1,314 @@
+// -*- C++ -*-
+//===-------------------------- dynarray ----------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_DYNARRAY
+#define _LIBCPP_DYNARRAY
+
+#include <__config>
+#if _LIBCPP_STD_VER > 11
+
+/*
+    dynarray synopsis
+
+namespace std { namespace experimental {
+
+template< typename T >
+class dynarray
+{
+    // 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;
+
+public:
+    // construct/copy/destroy:
+    explicit dynarray(size_type c);
+    template <typename Alloc>
+      dynarray(size_type c, const Alloc& alloc);
+    dynarray(size_type c, const T& v);
+    template <typename Alloc>
+      dynarray(size_type c, const T& v, const Alloc& alloc);
+    dynarray(const dynarray& d);
+    template <typename Alloc>
+      dynarray(const dynarray& d, const Alloc& alloc);
+    dynarray(initializer_list<T>);
+    template <typename 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);
+};
+
+}}  // std::experimental
+
+*/
+
+#include <__functional_base>
+#include <iterator>
+#include <stdexcept>
+#include <initializer_list>
+#include <new>
+#include <algorithm>
+
+#if defined(_LIBCPP_NO_EXCEPTIONS)
+    #include <cassert>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+namespace std { namespace experimental { inline namespace __array_extensions_v1 {
+
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY dynarray
+{
+public:
+    // types:
+    typedef dynarray __self;
+    typedef _Tp                                   value_type;
+    typedef value_type&                           reference;
+    typedef const value_type&                     const_reference;
+    typedef value_type*                           iterator;
+    typedef const value_type*                     const_iterator;
+    typedef value_type*                           pointer;
+    typedef const value_type*                     const_pointer;
+    typedef size_t                                size_type;
+    typedef ptrdiff_t                             difference_type;
+    typedef std::reverse_iterator<iterator>       reverse_iterator;
+    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+private:
+    size_t                  __size_;
+    value_type *            __base_;
+    _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
+    
+    static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
+    {
+        if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
+        {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+            throw bad_array_length();
+#else
+            assert(!"dynarray::allocation");
+#endif
+        }
+        return static_cast<value_type *> (::operator new (sizeof(value_type) * count));
+    }
+
+    static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
+    {
+        ::operator delete (static_cast<void *> (__ptr));
+    }
+
+public:
+
+    explicit dynarray(size_type __c);
+    dynarray(size_type __c, const value_type& __v);
+    dynarray(const dynarray& __d);
+    dynarray(initializer_list<value_type>);
+
+//  We're not implementing these right now.
+//  Waiting for the resolution of LWG issue #2235
+//     template <typename _Alloc>
+//       dynarray(size_type __c, const _Alloc& __alloc);
+//     template <typename _Alloc>
+//       dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
+//     template <typename _Alloc>
+//       dynarray(const dynarray& __d, const _Alloc& __alloc);
+//     template <typename _Alloc>
+//       dynarray(initializer_list<value_type>, const _Alloc& __alloc);
+
+    dynarray& operator=(const dynarray&) = delete;
+    ~dynarray();
+
+    // iterators:
+    inline _LIBCPP_INLINE_VISIBILITY iterator       begin()        noexcept { return iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator begin()  const noexcept { return const_iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
+    inline _LIBCPP_INLINE_VISIBILITY iterator       end()          noexcept { return iterator(data() + __size_); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator end()    const noexcept { return const_iterator(data() + __size_); }
+    inline _LIBCPP_INLINE_VISIBILITY const_iterator cend()   const noexcept { return const_iterator(data() + __size_); }
+
+    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rbegin()        noexcept { return reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin()  const noexcept { return const_reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
+    inline _LIBCPP_INLINE_VISIBILITY reverse_iterator       rend()          noexcept { return reverse_iterator(begin()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend()    const noexcept { return const_reverse_iterator(begin()); }
+    inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend()   const noexcept { return const_reverse_iterator(begin()); }
+
+    // capacity:
+    inline _LIBCPP_INLINE_VISIBILITY size_type size()     const noexcept { return __size_; }
+    inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
+    inline _LIBCPP_INLINE_VISIBILITY bool      empty()    const noexcept { return __size_ == 0; }
+
+    // element access:
+    inline _LIBCPP_INLINE_VISIBILITY reference       operator[](size_type __n)       { return data()[__n]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
+
+    inline _LIBCPP_INLINE_VISIBILITY reference       front()       { return data()[0]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
+    inline _LIBCPP_INLINE_VISIBILITY reference       back()        { return data()[__size_-1]; }
+    inline _LIBCPP_INLINE_VISIBILITY const_reference back()  const { return data()[__size_-1]; }
+
+    inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
+    inline _LIBCPP_INLINE_VISIBILITY reference       at(size_type __n);
+
+    // data access:
+    inline _LIBCPP_INLINE_VISIBILITY _Tp*       data()       noexcept { return __base_; }
+    inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
+
+    // mutating member functions:
+    inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
+};
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
+{
+    __base_ = __allocate (__c);
+    value_type *__data = data ();
+    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
+        ::new (__data) value_type;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
+{
+    __base_ = __allocate (__c);
+    value_type *__data = data ();
+    for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
+        ::new (__data) value_type (__v);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
+{
+    size_t sz = __il.size();
+    __base_ = __allocate (sz);
+    value_type *__data = data ();
+    auto src = __il.begin();
+    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
+        ::new (__data) value_type (*src);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
+{
+    size_t sz = __d.size();
+    __base_ = __allocate (sz);
+    value_type *__data = data ();
+    auto src = __d.begin();
+    for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
+        ::new (__data) value_type (*src);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+dynarray<_Tp>::~dynarray()
+{ 
+    value_type *__data = data () + __size_;
+    for ( size_t i = 0; i < __size_; ++i )
+        (--__data)->value_type::~value_type();
+    __deallocate ( __base_ );
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename dynarray<_Tp>::reference
+dynarray<_Tp>::at(size_type __n)
+{
+    if (__n >= __size_)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("dynarray::at");
+#else
+        assert(!"dynarray::at out_of_range");
+#endif
+    }
+    return data()[__n];
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename dynarray<_Tp>::const_reference
+dynarray<_Tp>::at(size_type __n) const
+{
+    if (__n >= __size_)
+    {
+#ifndef _LIBCPP_NO_EXCEPTIONS
+        throw out_of_range("dynarray::at");
+#else
+        assert(!"dynarray::at out_of_range");
+#endif
+    }
+    return data()[__n];
+}
+
+}}}
+
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp, class _Alloc>
+struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
+_LIBCPP_END_NAMESPACE_STD
+
+#endif  // if _LIBCPP_STD_VER > 11 
+#endif  // _LIBCPP_DYNARRAY

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/alloc.pass.cpp Wed Nov 13 16:44:48 2013
@@ -25,7 +25,7 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
@@ -33,15 +33,17 @@
 #include <string>
 #include "../../../test_allocator.h"
 
+using std::experimental::dynarray;
+
 template <class T, class Allocator>
-void check_allocator ( const std::dynarray<T> &dyn, const Allocator &alloc ) {
+void check_allocator ( const dynarray<T> &dyn, const Allocator &alloc ) {
     for ( int i = 0; i < dyn.size (); ++i )
         assert ( dyn[i].get_allocator() == alloc );
 }
 
 template <class T, class Allocator>
 void test ( const std::initializer_list<T> &vals, const Allocator &alloc ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( vals, alloc );
     assert ( d1.size () == vals.size() );
@@ -52,7 +54,7 @@ void test ( const std::initializer_list<
 
 template <class T, class Allocator>
 void test ( const T &val, const Allocator &alloc1, const Allocator &alloc2 ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4, alloc1 );
     assert ( d1.size () == 4 );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/default.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.cons/default.pass.cpp Wed Nov 13 16:44:48 2013
@@ -21,16 +21,18 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
 void test ( const std::initializer_list<T> &vals ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( vals );
     assert ( d1.size () == vals.size() );
@@ -40,7 +42,7 @@ void test ( const std::initializer_list<
 
 template <class T>
 void test ( const T &val ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4 );
     assert ( d1.size () == 4 );
@@ -56,13 +58,13 @@ void test ( const T &val ) {
     }
 
 void test_bad_length () {
-    try { std::dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
+    try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) + 1 ); }
     catch ( std::bad_array_length & ) { return ; }
     assert ( false );
     }
 
 void test_bad_alloc () {
-    try { std::dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) - 1 ); }
+    try { dynarray<int> ( std::numeric_limits<size_t>::max() / sizeof ( int ) - 1 ); }
     catch ( std::bad_alloc & ) { return ; }
     assert ( false );
     }
@@ -81,7 +83,7 @@ int main()
                 std::string("5"), std::string("8")} );
     
 //  Make sure we don't pick up the Allocator version here
-    std::dynarray<long> d1 ( 20, 3 );
+    dynarray<long> d1 ( 20, 3 );
     assert ( d1.size() == 20 );
     assert ( std::all_of ( d1.begin (), d1.end (), []( long item ){ return item == 3L; } ));
 

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.data/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.data/default.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.data/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.data/default.pass.cpp Wed Nov 13 16:44:48 2013
@@ -17,23 +17,24 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
 
 template <class T>
-void dyn_test_const ( const std::dynarray<T> &dyn ) {
+void dyn_test_const ( const dynarray<T> &dyn ) {
     const T *data = dyn.data ();
     assert ( data != NULL );
     assert ( std::equal ( dyn.begin(), dyn.end(), data ));
     }
 
 template <class T>
-void dyn_test ( std::dynarray<T> &dyn ) {
+void dyn_test ( dynarray<T> &dyn ) {
     T *data = dyn.data ();
     assert ( data != NULL );
     assert ( std::equal ( dyn.begin(), dyn.end(), data ));
@@ -43,7 +44,7 @@ void dyn_test ( std::dynarray<T> &dyn )
 
 template <class T>
 void test ( const T &val ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4 );
     dyn_test ( d1 );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.mutate/default.pass.cpp Wed Nov 13 16:44:48 2013
@@ -17,17 +17,18 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
 
 template <class T>
 void test ( const T &val ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4 );
     d1.fill ( val );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/at.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/at.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/at.pass.cpp Wed Nov 13 16:44:48 2013
@@ -16,22 +16,24 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
-void dyn_at_fail ( std::dynarray<T> &dyn, size_t sz ) {
+void dyn_at_fail ( dynarray<T> &dyn, size_t sz ) {
     try { dyn.at (sz); }
     catch (const std::out_of_range &) { return; }
     assert ( false );
     }
 
 template <class T>
-void dyn_at_fail_const ( const std::dynarray<T> &dyn, size_t sz ) {
+void dyn_at_fail_const ( const dynarray<T> &dyn, size_t sz ) {
     try { dyn.at (sz); }
     catch (const std::out_of_range &) { return; }
     assert ( false );
@@ -39,7 +41,7 @@ void dyn_at_fail_const ( const std::dyna
 
 
 template <class T>
-void dyn_test_const ( const std::dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
     const T *data = dyn.data ();
     auto it = vals.begin ();
     for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
@@ -53,7 +55,7 @@ void dyn_test_const ( const std::dynarra
     }
 
 template <class T>
-void dyn_test ( std::dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
     T *data = dyn.data ();
     auto it = vals.begin ();
     for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
@@ -69,7 +71,7 @@ void dyn_test ( std::dynarray<T> &dyn, c
 
 template <class T>
 void test ( std::initializer_list<T> vals ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( vals );
     dyn_test ( d1, vals );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/begin_end.pass.cpp Wed Nov 13 16:44:48 2013
@@ -29,15 +29,17 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
-void dyn_test_const ( const std::dynarray<T> &dyn ) {
+void dyn_test_const ( const dynarray<T> &dyn ) {
     const T *data = dyn.data ();
     assert ( data == &*dyn.begin ());
     assert ( data == &*dyn.cbegin ());
@@ -59,7 +61,7 @@ void dyn_test_const ( const std::dynarra
     }
 
 template <class T>
-void dyn_test ( std::dynarray<T> &dyn ) {
+void dyn_test ( dynarray<T> &dyn ) {
     T *data = dyn.data ();
     assert ( data == &*dyn.begin ());
     assert ( data == &*dyn.cbegin ());
@@ -83,7 +85,7 @@ void dyn_test ( std::dynarray<T> &dyn )
 
 template <class T>
 void test ( const T &val ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4 );
     dyn_test ( d1 );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/capacity.pass.cpp Wed Nov 13 16:44:48 2013
@@ -17,15 +17,17 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
-void dyn_test ( const std::dynarray<T> &dyn, size_t sz ) {
+void dyn_test ( const dynarray<T> &dyn, size_t sz ) {
     assert ( dyn.size ()     == sz );
     assert ( dyn.max_size () == sz );
     assert ( dyn.empty () == ( sz == 0 ));
@@ -33,7 +35,7 @@ void dyn_test ( const std::dynarray<T> &
 
 template <class T>
 void test ( std::initializer_list<T> vals ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( vals );
     dyn_test ( d1, vals.size ());

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/front_back.pass.cpp Wed Nov 13 16:44:48 2013
@@ -19,22 +19,24 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
-void dyn_test_const ( const std::dynarray<T> &dyn ) {
+void dyn_test_const ( const dynarray<T> &dyn ) {
     const T *data = dyn.data ();
     assert ( *data == dyn.front ());
     assert ( *(data + dyn.size() - 1 ) == dyn.back ());
     }
 
 template <class T>
-void dyn_test ( std::dynarray<T> &dyn ) {
+void dyn_test ( dynarray<T> &dyn ) {
     T *data = dyn.data ();
     assert ( *data == dyn.front ());
     assert ( *(data + dyn.size() - 1 ) == dyn.back ());
@@ -43,7 +45,7 @@ void dyn_test ( std::dynarray<T> &dyn )
 
 template <class T>
 void test ( const T &val ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 4 );
     dyn_test ( d1 );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.overview/indexing.pass.cpp Wed Nov 13 16:44:48 2013
@@ -16,15 +16,17 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
+
 template <class T>
-void dyn_test_const ( const std::dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+void dyn_test_const ( const dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
     const T *data = dyn.data ();
     auto it = vals.begin ();
     for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
@@ -34,7 +36,7 @@ void dyn_test_const ( const std::dynarra
     }
 
 template <class T>
-void dyn_test ( std::dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
+void dyn_test ( dynarray<T> &dyn, const std::initializer_list<T> &vals ) {
     T *data = dyn.data ();
     auto it = vals.begin ();
     for ( size_t i = 0; i < dyn.size(); ++i, ++it ) {
@@ -46,7 +48,7 @@ void dyn_test ( std::dynarray<T> &dyn, c
 
 template <class T>
 void test ( std::initializer_list<T> vals ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( vals );
     dyn_test ( d1, vals );

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.traits/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.traits/default.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.traits/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.traits/default.pass.cpp Wed Nov 13 16:44:48 2013
@@ -17,12 +17,14 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include "../../../test_allocator.h"
 
+using std::experimental::dynarray;
+
 int main()
 {
-    static_assert ( std::uses_allocator<std::dynarray<int>, test_allocator<int>>::value, "" );
+    static_assert ( std::uses_allocator<dynarray<int>, test_allocator<int>>::value, "" );
 }
 #else
 int main() {}

Modified: libcxx/trunk/test/containers/sequences/dynarray/dynarray.zero/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/containers/sequences/dynarray/dynarray.zero/default.pass.cpp?rev=194614&r1=194613&r2=194614&view=diff
==============================================================================
--- libcxx/trunk/test/containers/sequences/dynarray/dynarray.zero/default.pass.cpp (original)
+++ libcxx/trunk/test/containers/sequences/dynarray/dynarray.zero/default.pass.cpp Wed Nov 13 16:44:48 2013
@@ -20,17 +20,18 @@
 
 #if _LIBCPP_STD_VER > 11
 
-#include <dynarray>
+#include <experimental/dynarray>
 #include <cassert>
 
 #include <algorithm>
 #include <complex>
 #include <string>
 
+using std::experimental::dynarray;
 
 template <class T>
 void test ( ) {
-    typedef std::dynarray<T> dynA;
+    typedef dynarray<T> dynA;
     
     dynA d1 ( 0 );
     assert ( d1.size() == 0 );





More information about the cfe-commits mailing list