X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=boost%2Fnumeric%2Fublas%2Fstorage.hpp;h=9dfaaee076c7effb6f8c4b811e958a430e9b0316;hb=08c1e93fa36a49f49325a07fe91ff92c964c2b6c;hp=b7f9009b2e4f04f85731a7883d1c28c6c1a0a43c;hpb=bb4dd8289b351fae6b55e303f189127a394a1edd;p=platform%2Fupstream%2Fboost.git diff --git a/boost/numeric/ublas/storage.hpp b/boost/numeric/ublas/storage.hpp index b7f9009..9dfaaee 100644 --- a/boost/numeric/ublas/storage.hpp +++ b/boost/numeric/ublas/storage.hpp @@ -128,7 +128,7 @@ namespace boost { namespace numeric { namespace ublas { } } else { - for (pointer si = p_data; si != p_data + size_; ++si) { + for (; si != p_data + size_; ++si) { alloc_.construct (di, *si); ++di; } @@ -229,9 +229,17 @@ namespace boost { namespace numeric { namespace ublas { return data_; } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return data_ + size_; } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } BOOST_UBLAS_INLINE iterator begin () { @@ -251,10 +259,18 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } + BOOST_UBLAS_INLINE reverse_iterator rbegin () { return reverse_iterator (end ()); } @@ -273,7 +289,7 @@ namespace boost { namespace numeric { namespace ublas { // Serialization template - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int /*version*/) { serialization::collection_size_type s(size_); ar & serialization::make_nvp("size",s); @@ -412,9 +428,17 @@ namespace boost { namespace numeric { namespace ublas { return data_; } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return data_ + size_; } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } BOOST_UBLAS_INLINE iterator begin () { @@ -434,10 +458,18 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } + BOOST_UBLAS_INLINE reverse_iterator rbegin () { return reverse_iterator (end ()); } @@ -451,7 +483,7 @@ namespace boost { namespace numeric { namespace ublas { friend class boost::serialization::access; template - void serialize(Archive & ar, const unsigned int version) + void serialize(Archive & ar, const unsigned int /*version*/) { serialization::collection_size_type s(size_); ar & serialization::make_nvp("size", s); @@ -464,7 +496,12 @@ namespace boost { namespace numeric { namespace ublas { private: size_type size_; +// MSVC does not like arrays of size 0 in base classes. Hence, this conditionally changes the size to 1 +#ifdef _MSC_VER + BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [(N>0)?N:1]; +#else BOOST_UBLAS_BOUNDED_ARRAY_ALIGN value_type data_ [N]; +#endif }; @@ -623,9 +660,17 @@ namespace boost { namespace numeric { namespace ublas { return data_; } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return data_ + size_; } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } typedef pointer iterator; @@ -647,10 +692,18 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } + BOOST_UBLAS_INLINE reverse_iterator rbegin () { return reverse_iterator (end ()); } @@ -819,9 +872,17 @@ namespace boost { namespace numeric { namespace ublas { return data_.get (); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return data_.get () + size_; } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } typedef pointer iterator; @@ -843,10 +904,18 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } + BOOST_UBLAS_INLINE reverse_iterator rbegin () { return reverse_iterator (end ()); } @@ -1038,9 +1107,17 @@ namespace boost { namespace numeric { namespace ublas { return const_iterator (*this, start_); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return const_iterator (*this, start_ + size_); } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } // Reverse iterator typedef std::reverse_iterator const_reverse_iterator; @@ -1050,9 +1127,17 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } + BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } BOOST_UBLAS_INLINE basic_range preprocess (size_type size) const { @@ -1257,9 +1342,17 @@ namespace boost { namespace numeric { namespace ublas { return const_iterator (*this, 0); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return const_iterator (*this, size_); } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } // Reverse iterator typedef std::reverse_iterator const_reverse_iterator; @@ -1269,9 +1362,17 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } + BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } BOOST_UBLAS_INLINE basic_slice preprocess (size_type size) const { @@ -1517,9 +1618,17 @@ namespace boost { namespace numeric { namespace ublas { return const_iterator (*this, 0); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end () const { return const_iterator (*this, size_); } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } // Reverse iterator typedef std::reverse_iterator const_reverse_iterator; @@ -1529,9 +1638,17 @@ namespace boost { namespace numeric { namespace ublas { return const_reverse_iterator (end ()); } BOOST_UBLAS_INLINE + const_reverse_iterator crbegin () const { + return rbegin (); + } + BOOST_UBLAS_INLINE const_reverse_iterator rend () const { return const_reverse_iterator (begin ()); } + BOOST_UBLAS_INLINE + const_reverse_iterator crend () const { + return rend (); + } BOOST_UBLAS_INLINE indirect_array preprocess (size_type size) const { @@ -1564,7 +1681,6 @@ namespace boost { namespace numeric { namespace ublas { template class index_pair : - private boost::noncopyable, public container_reference { typedef index_pair self_type; @@ -1603,11 +1719,17 @@ namespace boost { namespace numeric { namespace ublas { rhs = *this; *this = tmp; } + BOOST_UBLAS_INLINE friend void swap(self_type& lhs, self_type& rhs) { lhs.swap(rhs); } + friend void swap(self_type lhs, self_type rhs) { // For gcc 4.8 and c++11 + lhs.swap(rhs); + } + + BOOST_UBLAS_INLINE bool equal(const self_type& rhs) const { return (v1_ == rhs.v1_); @@ -1700,9 +1822,17 @@ namespace boost { namespace numeric { namespace ublas { return const_iterator( (*this), 0); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end() const { return const_iterator( (*this), size()); } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } // unnecessary function: BOOST_UBLAS_INLINE @@ -1734,7 +1864,6 @@ namespace boost { namespace numeric { namespace ublas { template class index_triple : - private boost::noncopyable, public container_reference { typedef index_triple self_type; @@ -1775,11 +1904,16 @@ namespace boost { namespace numeric { namespace ublas { rhs = *this; *this = tmp; } + BOOST_UBLAS_INLINE friend void swap(self_type& lhs, self_type& rhs) { lhs.swap(rhs); } + friend void swap(self_type lhs, self_type rhs) { // For gcc 4.8 and c++11 + lhs.swap(rhs); + } + BOOST_UBLAS_INLINE bool equal(const self_type& rhs) const { return ((v1_ == rhs.v1_) && (v2_ == rhs.v2_)); @@ -1875,9 +2009,17 @@ namespace boost { namespace numeric { namespace ublas { return const_iterator( (*this), 0); } BOOST_UBLAS_INLINE + const_iterator cbegin () const { + return begin (); + } + BOOST_UBLAS_INLINE const_iterator end() const { return const_iterator( (*this), size()); } + BOOST_UBLAS_INLINE + const_iterator cend () const { + return end (); + } // unnecessary function: BOOST_UBLAS_INLINE