]> git.sesse.net Git - casparcg/blobdiff - common/memory/array.cpp
2.1.0: changed "const_array" and "mutable_array" into generic "array" with const...
[casparcg] / common / memory / array.cpp
index f635d0e2816366d77e1d4dc86699c4f04f2d7d21..7cb0ab764c7c5e4180f8debb288b75252d9273c1 100644 (file)
 #include "../assert.h"\r
 \r
 namespace caspar { namespace core {\r
-               \r
-mutable_array::mutable_array(mutable_array&& other)\r
-       : ptr_(other.ptr_)\r
-       , size_(other.size_)\r
-       , cacheable_(other.cacheable_)\r
-       , storage_(std::move(other.storage_))\r
-{\r
-       CASPAR_ASSERT(storage_);\r
-}\r
-       \r
-mutable_array& mutable_array::operator=(mutable_array&& other)\r
-{\r
-       ptr_            = other.ptr_;\r
-       size_           = other.size_;\r
-       cacheable_  = other.cacheable_;\r
-       storage_        = std::move(other.storage_);\r
-\r
-       CASPAR_ASSERT(storage_);\r
-\r
-       return *this;\r
-}\r
-               \r
-std::uint8_t* mutable_array::begin()                           {return ptr_;}          \r
-std::uint8_t* mutable_array::data()                                    {return ptr_;}\r
-std::uint8_t* mutable_array::end()                                     {return ptr_ + size_;}  \r
-const std::uint8_t* mutable_array::begin() const       {return ptr_;}          \r
-const std::uint8_t* mutable_array::data() const                {return ptr_;}\r
-const std::uint8_t* mutable_array::end() const         {return ptr_ + size_;}\r
-std::size_t mutable_array::size() const                                {return size_;}\r
-bool mutable_array::empty() const                                      {return size() == 0;}\r
-bool mutable_array::cacheable() const                          {return cacheable_;}\r
-\r
-const_array::const_array(const const_array& other)\r
-       : ptr_(other.ptr_)\r
-       , size_(other.size_)\r
-       , cacheable_(other.cacheable_)\r
-       , storage_(other.storage_)\r
-{\r
-       CASPAR_ASSERT(storage_);\r
-}\r
-\r
-const_array::const_array(mutable_array&& other)\r
-       : ptr_(other.ptr_)\r
-       , size_(other.size_)\r
-       , cacheable_(other.cacheable_)\r
-       , storage_(std::move(other.storage_))\r
-{\r
-       CASPAR_ASSERT(storage_);\r
-}\r
-\r
-const_array& const_array::operator=(const const_array& other)\r
-{\r
-       const_array(other).swap(*this);\r
-       return *this;\r
-}\r
-\r
-void const_array::swap(const_array& other)\r
-{\r
-       ptr_            = other.ptr_;\r
-       size_           = other.size_;\r
-       storage_        = other.storage_;\r
-       cacheable_      = other.cacheable_;\r
-}\r
-                       \r
-const std::uint8_t* const_array::begin() const {return ptr_;}          \r
-const std::uint8_t* const_array::data() const  {return ptr_;}\r
-const std::uint8_t* const_array::end() const   {return ptr_ + size_;}\r
-std::size_t const_array::size() const                  {return size_;}\r
-bool const_array::empty() const                                        {return size() == 0;}\r
-bool const_array::cacheable() const                            {return cacheable_;}\r
 \r
 }}
\ No newline at end of file