Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82043 - in sandbox/static_vector: boost/container test
From: adam.wulkiewicz_at_[hidden]
Date: 2012-12-16 19:41:43


Author: awulkiew
Date: 2012-12-16 19:41:43 EST (Sun, 16 Dec 2012)
New Revision: 82043
URL: http://svn.boost.org/trac/boost/changeset/82043

Log:
Added static_vector global functions/operators.
Text files modified:
   sandbox/static_vector/boost/container/static_vector.hpp | 43 ++++++++++++++++++++++++++++++++++++++++
   sandbox/static_vector/test/static_vector.cpp | 14 +++++++++++++
   2 files changed, 57 insertions(+), 0 deletions(-)

Modified: sandbox/static_vector/boost/container/static_vector.hpp
==============================================================================
--- sandbox/static_vector/boost/container/static_vector.hpp (original)
+++ sandbox/static_vector/boost/container/static_vector.hpp 2012-12-16 19:41:43 EST (Sun, 16 Dec 2012)
@@ -1123,6 +1123,49 @@
 
 }} // namespace detail::static_vector
 
+// comparisons
+template<typename V, std::size_t C, typename S>
+bool operator== (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
+}
+
+template<typename V, std::size_t C, typename S>
+bool operator< (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
+}
+
+template<typename V, std::size_t C, typename S>
+bool operator!= (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return !(x==y);
+}
+
+template<typename V, std::size_t C, typename S>
+bool operator> (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return y<x;
+}
+
+template<typename V, std::size_t C, typename S>
+bool operator<= (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return !(y<x);
+}
+
+template<typename V, std::size_t C, typename S>
+bool operator>= (static_vector<V, C, S> const& x, static_vector<V, C, S> const& y)
+{
+ return !(x<y);
+}
+
+template<typename V, std::size_t C, typename S>
+inline void swap(static_vector<V, C, S> & x, static_vector<V, C, S> & y)
+{
+ x.swap(y);
+}
+
 }} // namespace boost::container
 
 #endif // BOOST_CONTAINER_STATIC_VECTOR_HPP

Modified: sandbox/static_vector/test/static_vector.cpp
==============================================================================
--- sandbox/static_vector/test/static_vector.cpp (original)
+++ sandbox/static_vector/test/static_vector.cpp 2012-12-16 19:41:43 EST (Sun, 16 Dec 2012)
@@ -483,6 +483,20 @@
     }catch(std::bad_alloc &){}
 }
 
+template <typename T, size_t N>
+void test_swap_nd()
+{
+ static_vector<T, N> v;
+ static_vector<T, N/2> s;
+
+ for (size_t i = 0 ; i < N ; ++i )
+ v.push_back(T(i));
+ for (size_t i = 0 ; i < N/2 ; ++i )
+ s.push_back(T(i));
+
+ //TODO
+}
+
 int test_main(int, char* [])
 {
     BOOST_CHECK(counting_value::count() == 0);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk