aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/vector-traits.hxx4
-rw-r--r--odb/vector-traits.txx4
-rw-r--r--odb/vector.hxx166
-rw-r--r--odb/vector.ixx199
4 files changed, 210 insertions, 163 deletions
diff --git a/odb/vector-traits.hxx b/odb/vector-traits.hxx
index 0cebba2..d996a89 100644
--- a/odb/vector-traits.hxx
+++ b/odb/vector-traits.hxx
@@ -14,8 +14,8 @@
namespace odb
{
- template <typename V, typename A>
- class access::container_traits<vector<V, A> >
+ template <typename V, typename A LIBODB_VECTOR_ARG_DECL>
+ class access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >
{
public:
static const container_kind kind = ck_ordered;
diff --git a/odb/vector-traits.txx b/odb/vector-traits.txx
index 26180b0..66f757a 100644
--- a/odb/vector-traits.txx
+++ b/odb/vector-traits.txx
@@ -4,8 +4,8 @@
namespace odb
{
- template <typename V, typename A>
- void access::container_traits<vector<V, A> >::
+ template <typename V, typename A LIBODB_VECTOR_ARG_DECL>
+ void access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >::
update (const container_type& c, const functions& f)
{
bool u (false); // Updated flag.
diff --git a/odb/vector.hxx b/odb/vector.hxx
index 5f1371a..6aeab25 100644
--- a/odb/vector.hxx
+++ b/odb/vector.hxx
@@ -10,6 +10,7 @@
#include <vector>
#include <iterator>
+#include <cstddef> // std::ptrdiff_t
#ifdef ODB_CXX11
# include <utility> // std::move, std::forward
@@ -20,6 +21,22 @@
#include <odb/vector-impl.hxx>
+// Because both std::vector and odb::vector are called 'vector' (who
+// cares about namespace qualifications, right?), Sun CC complains
+// with a bogus "Ambiguous partial specialization" error. A really
+// hideous workaround for this bug is to to add a dummy third template
+// argument (with a default value).
+//
+#ifdef __SUNPRO_CC
+# define LIBODB_VECTOR_ARG_DEFAULT ,int = 0
+# define LIBODB_VECTOR_ARG_DECL ,int DUMMY
+# define LIBODB_VECTOR_ARG_USE ,DUMMY
+#else
+# define LIBODB_VECTOR_ARG_DEFAULT
+# define LIBODB_VECTOR_ARG_DECL
+# define LIBODB_VECTOR_ARG_USE
+#endif
+
namespace odb
{
// An std::vector-like container that keeps track of changes.
@@ -30,7 +47,7 @@ namespace odb
template <class V, class I>
class vector_iterator;
- template <class T, class A = std::allocator<T> >
+ template <class T, class A = std::allocator<T> LIBODB_VECTOR_ARG_DEFAULT>
class vector: public vector_base
{
public:
@@ -50,8 +67,12 @@ namespace odb
typedef A allocator_type;
typedef typename base_vector_type::pointer pointer;
typedef typename base_vector_type::const_pointer const_pointer;
+ // No non-const reverse iterator support for Sun CC with non-standard STL.
+ //
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
typedef vector_iterator<vector, base_reverse_iterator_type>
reverse_iterator;
+#endif
typedef typename base_vector_type::const_reverse_iterator
const_reverse_iterator;
// construct/copy/destroy:
@@ -86,12 +107,14 @@ namespace odb
// iterators: (all /*noexcept*/)
//
iterator begin() {return iterator (this, v_.begin ());}
- const_iterator begin() const {return v_.begin ();}
iterator end() {return iterator (this, v_.end ());}
+ const_iterator begin() const {return v_.begin ();}
const_iterator end() const {return v_.end ();}
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
reverse_iterator rbegin() {return reverse_iterator (this, v_.rbegin ());}
- const_reverse_iterator rbegin() const {return v_.rbegin ();}
reverse_iterator rend() {return reverse_iterator (this, v_.rend ());}
+#endif
+ const_reverse_iterator rbegin() const {return v_.rbegin ();}
const_reverse_iterator rend() const {return v_.rend ();}
// Return standard vector iterators. The begin() functions mark all
@@ -203,68 +226,84 @@ namespace odb
using odb::vector;
}
- template <class T, class A>
- inline bool operator==(const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator==(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () == y.base ();}
- template <class T, class A>
- inline bool operator==(const vector<T,A>& x, const std::vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator==(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const std::vector<T,A>& y)
{return x.base () == y;}
- template <class T, class A>
- inline bool operator==(const std::vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator==(const std::vector<T,A>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x == y.base ();}
- template <class T, class A>
- inline bool operator< (const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator< (const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () < y.base ();}
- template <class T, class A>
- inline bool operator<(const vector<T,A>& x, const std::vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator<(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const std::vector<T,A>& y)
{return x.base () < y;}
- template <class T, class A>
- inline bool operator<(const std::vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator<(const std::vector<T,A>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x < y.base ();}
- template <class T, class A>
- inline bool operator!=(const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator!=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () != y.base ();}
- template <class T, class A>
- inline bool operator!=(const vector<T,A>& x, const std::vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator!=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const std::vector<T,A>& y)
{return x.base () != y;}
- template <class T, class A>
- inline bool operator!=(const std::vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator!=(const std::vector<T,A>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x != y.base ();}
- template <class T, class A>
- inline bool operator> (const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator> (const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () > y.base ();}
- template <class T, class A>
- inline bool operator>=(const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator>=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () >= y.base ();}
- template <class T, class A>
- inline bool operator>=(const vector<T,A>& x, const std::vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator>=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const std::vector<T,A>& y)
{return x.base () >= y;}
- template <class T, class A>
- inline bool operator>=(const std::vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator>=(const std::vector<T,A>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x >= y.base ();}
- template <class T, class A>
- inline bool operator<=(const vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator<=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x.base () <= y.base ();}
- template <class T, class A>
- inline bool operator<=(const vector<T,A>& x, const std::vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator<=(const vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ const std::vector<T,A>& y)
{return x.base () <= y;}
- template <class T, class A>
- inline bool operator<=(const std::vector<T,A>& x, const vector<T,A>& y)
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline bool operator<=(const std::vector<T,A>& x,
+ const vector<T,A LIBODB_VECTOR_ARG_USE>& y)
{return x <= y.base ();}
template <class V, class I>
@@ -274,6 +313,10 @@ namespace odb
typedef V vector_type;
typedef I base_iterator_type;
typedef typename vector_type::const_iterator const_iterator_type;
+
+ // Sun CC with non-standard STL does not have iterator_traits.
+ //
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
typedef std::iterator_traits<base_iterator_type> base_iterator_traits;
typedef typename base_iterator_traits::value_type value_type;
@@ -281,6 +324,15 @@ namespace odb
typedef typename base_iterator_traits::pointer pointer;
typedef typename base_iterator_traits::reference reference;
typedef typename base_iterator_traits::iterator_category iterator_category;
+#else
+ // Base iterator is just a pointer.
+ //
+ typedef typename vector_type::value_type value_type;
+ typedef typename vector_type::pointer pointer;
+ typedef typename vector_type::reference reference;
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef std::ptrdiff_t difference_type;
+#endif
typedef typename vector_type::size_type size_type;
typedef typename vector_type::const_reference const_reference;
@@ -301,8 +353,23 @@ namespace odb
// Modifiers.
//
- reference modify () const;
- reference modify (difference_type n) const;
+ // Buggy Sun CC cannot have them out of class.
+ //
+ reference modify () const
+ {
+ if (v_->_tracking ())
+ v_->_impl ().modify (
+ static_cast<size_type> (i_ - v_->base ().begin ()));
+ return *i_;
+ }
+
+ reference modify (difference_type n) const
+ {
+ if (v_->_tracking ())
+ v_->_impl ().modify (
+ static_cast<size_type> (i_ - v_->base ().begin () + n));
+ return i_[n];
+ }
vector_iterator& operator++ () {++i_; return *this;}
vector_iterator operator++ (int) {return vector_iterator (v_, i_++);}
@@ -326,6 +393,7 @@ namespace odb
base_iterator_type i_;
};
+#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC
template <class V, class J>
class vector_iterator<V, std::reverse_iterator<J> >
{
@@ -364,8 +432,22 @@ namespace odb
// Modifiers.
//
- reference modify () const;
- reference modify (difference_type n) const;
+ reference modify () const
+ {
+ if (v_->_tracking ())
+ v_->_impl ().modify (
+ static_cast<size_type> (v_->base ().rend () - i_ - 1));
+ return *i_;
+ }
+
+ reference modify (difference_type n) const
+ {
+ if (v_->_tracking ())
+ // Note: going in the opposite direction.
+ v_->_impl ().modify (
+ static_cast<size_type> (v_->base ().rend () - i_ - 1 - n));
+ return i_[n];
+ }
vector_iterator& operator++ () {++i_; return *this;}
vector_iterator operator++ (int) {return vector_iterator (v_, i_++);}
@@ -388,6 +470,7 @@ namespace odb
vector_type* v_;
base_iterator_type i_;
};
+#endif // _RWSTD_NO_CLASS_PARTIAL_SPEC
// operator==
//
@@ -533,8 +616,9 @@ namespace odb
namespace std
{
- template <class T, class A>
- inline void swap(odb::vector<T,A>& x, odb::vector<T,A>& y) {x.swap (y);}
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void swap(odb::vector<T,A LIBODB_VECTOR_ARG_USE>& x,
+ odb::vector<T,A LIBODB_VECTOR_ARG_USE>& y) {x.swap (y);}
}
#include <odb/vector.ixx>
diff --git a/odb/vector.ixx b/odb/vector.ixx
index 1fd9a1b..b23238b 100644
--- a/odb/vector.ixx
+++ b/odb/vector.ixx
@@ -4,14 +4,11 @@
namespace odb
{
- //
- // vector
- //
-
// construct/copy/destroy:
//
- template <class T, class A>
- inline vector<T, A>& vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline vector<T, A LIBODB_VECTOR_ARG_USE>&
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
operator= (const vector& x)
{
v_ = x.v_;
@@ -20,9 +17,9 @@ namespace odb
return *this;
}
- template <class T, class A>
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
template <class I>
- inline void vector<T, A>::
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
assign (I f, I l)
{
v_.assign (f, l);
@@ -30,8 +27,8 @@ namespace odb
impl_.assign (v_.size ());
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
assign (size_type n, const T& u)
{
v_.assign (n, u);
@@ -40,8 +37,9 @@ namespace odb
}
#ifdef ODB_CXX11
- template <class T, class A>
- inline vector<T, A>& vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline vector<T, A LIBODB_VECTOR_ARG_USE>&
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
operator=(vector&& x)
{
v_ = std::move (x.v_);
@@ -51,8 +49,9 @@ namespace odb
}
#ifdef ODB_CXX11_INITIALIZER_LIST
- template <class T, class A>
- inline vector<T, A>& vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline vector<T, A LIBODB_VECTOR_ARG_USE>&
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
operator= (std::initializer_list<T> il)
{
v_ = il;
@@ -61,8 +60,8 @@ namespace odb
return *this;
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
assign (std::initializer_list<T> il)
{
v_.assign (il);
@@ -74,8 +73,9 @@ namespace odb
// iterators:
//
- template <class T, class A>
- inline typename vector<T, A>::base_iterator_type vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::base_iterator_type
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
mbegin ()
{
if (_tracking ())
@@ -83,8 +83,10 @@ namespace odb
return v_.begin ();
}
- template <class T, class A>
- inline typename vector<T, A>::base_reverse_iterator_type vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline
+ typename vector<T, A LIBODB_VECTOR_ARG_USE>::base_reverse_iterator_type
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
mrbegin ()
{
if (_tracking ())
@@ -94,8 +96,8 @@ namespace odb
// capacity:
//
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
resize (size_type n)
{
v_.resize (n);
@@ -103,8 +105,8 @@ namespace odb
impl_.resize (n);
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
resize (size_type n, const T& c)
{
v_.resize (n, c);
@@ -112,8 +114,8 @@ namespace odb
impl_.resize (n);
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
reserve (size_type n)
{
v_.reserve (n);
@@ -122,8 +124,8 @@ namespace odb
}
#ifdef ODB_CXX11
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
shrink_to_fit ()
{
v_.shrink_to_fit ();
@@ -133,8 +135,9 @@ namespace odb
// element access:
//
- template <class T, class A>
- inline typename vector<T, A>::reference vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::reference
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
modify (size_type n)
{
reference r (v_[n]);
@@ -143,8 +146,9 @@ namespace odb
return r;
}
- template <class T, class A>
- inline typename vector<T, A>::reference vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::reference
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
modify_at (size_type n)
{
reference r (v_.at (n));
@@ -153,8 +157,9 @@ namespace odb
return r;
}
- template <class T, class A>
- inline typename vector<T, A>::reference vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::reference
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
modify_front ()
{
reference r (v_.front ());
@@ -163,8 +168,9 @@ namespace odb
return r;
}
- template <class T, class A>
- inline typename vector<T, A>::reference vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::reference
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
modify_back ()
{
reference r (v_.back ());
@@ -174,8 +180,8 @@ namespace odb
}
#ifdef ODB_CXX11
- template <class T, class A>
- inline T* vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline T* vector<T, A LIBODB_VECTOR_ARG_USE>::
modify_data() /*noexcept*/
{
if (_tracking ())
@@ -186,8 +192,8 @@ namespace odb
// modifiers:
//
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
push_back (const T& x)
{
v_.push_back (x);
@@ -195,8 +201,8 @@ namespace odb
impl_.push_back ();
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
pop_back ()
{
v_.pop_back ();
@@ -204,8 +210,9 @@ namespace odb
impl_.pop_back ();
}
- template <class T, class A>
- inline typename vector<T, A>::iterator vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::iterator
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
insert (iterator p, const T& x)
{
if (_tracking ())
@@ -213,8 +220,8 @@ namespace odb
return iterator (this, v_.insert (p.base (), x));
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
insert (iterator p, size_type n, const T& x)
{
if (_tracking ())
@@ -222,9 +229,9 @@ namespace odb
v_.insert (p.base (), n, x);
}
- template <class T, class A>
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
template <class I>
- inline void vector<T, A>::
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
insert (iterator p, I f, I l)
{
size_type i, n;
@@ -240,8 +247,9 @@ namespace odb
impl_.insert (i, v_.size () - n);
}
- template <class T, class A>
- inline typename vector<T, A>::iterator vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::iterator
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
erase (iterator p)
{
if (_tracking ())
@@ -249,8 +257,9 @@ namespace odb
return iterator (this, v_.erase (p.base ()));
}
- template <class T, class A>
- inline typename vector<T, A>::iterator vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::iterator
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
erase (iterator f, iterator l)
{
if (_tracking ())
@@ -259,16 +268,16 @@ namespace odb
return iterator (this, v_.erase (f.base (), l.base ()));
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
swap (vector& x)
{
v_.swap (x.v_);
vector_base::swap (x);
}
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
clear ()
{
v_.clear ();
@@ -277,8 +286,8 @@ namespace odb
}
#ifdef ODB_CXX11
- template <class T, class A>
- inline void vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
push_back(T&& x)
{
v_.push_back (std::move (x));
@@ -286,8 +295,9 @@ namespace odb
impl_.push_back ();
}
- template <class T, class A>
- inline typename vector<T, A>::iterator vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::iterator
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
insert (iterator p, T&& x)
{
base_iterator_type r (v_.insert (p.base (), std::move (x)));
@@ -297,9 +307,9 @@ namespace odb
}
#ifdef ODB_CXX11_VARIADIC_TEMPLATE
- template <class T, class A>
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
template <class... Args>
- inline void vector<T, A>::
+ inline void vector<T, A LIBODB_VECTOR_ARG_USE>::
emplace_back (Args&&... args)
{
v_.push_back (std::forward<Args> (args)...);
@@ -307,9 +317,10 @@ namespace odb
impl_.push_back ();
}
- template <class T, class A>
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
template <class... Args>
- inline typename vector<T, A>::iterator vector<T, A>::
+ inline typename vector<T, A LIBODB_VECTOR_ARG_USE>::iterator
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
emplace (iterator p, Args&&... args)
{
base_iterator_type r (
@@ -323,8 +334,9 @@ namespace odb
// Interfacing with base vector.
//
- template <class T, class A>
- inline vector<T, A>& vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline vector<T, A LIBODB_VECTOR_ARG_USE>&
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
operator= (const base_vector_type& x)
{
v_ = x;
@@ -334,8 +346,9 @@ namespace odb
}
#ifdef ODB_CXX11
- template <class T, class A>
- inline vector<T, A>& vector<T, A>::
+ template <class T, class A LIBODB_VECTOR_ARG_DECL>
+ inline vector<T, A LIBODB_VECTOR_ARG_USE>&
+ vector<T, A LIBODB_VECTOR_ARG_USE>::
operator= (base_vector_type&& x)
{
v_ = std::move (x);
@@ -344,54 +357,4 @@ namespace odb
return *this;
}
#endif
-
- //
- // vector_iterator
- //
-
- template <class V, class I>
- inline typename vector_iterator<V, I>::reference vector_iterator<V, I>::
- modify () const
- {
- if (v_->_tracking ())
- v_->_impl ().modify (static_cast<size_type> (i_ - v_->base ().begin ()));
- return *i_;
- }
-
- template <class V, class I>
- inline typename vector_iterator<V, I>::reference vector_iterator<V, I>::
- modify (difference_type n) const
- {
- if (v_->_tracking ())
- v_->_impl ().modify (
- static_cast<size_type> (i_ - v_->base ().begin () + n));
- return i_[n];
- }
-
- //
- // vector_iterator<std::reverse_iterator>
- //
-
- template <class V, class J>
- inline typename vector_iterator<V, std::reverse_iterator<J> >::reference
- vector_iterator<V, std::reverse_iterator<J> >::
- modify () const
- {
- if (v_->_tracking ())
- v_->_impl ().modify (
- static_cast<size_type> (v_->base ().rend () - i_ - 1));
- return *i_;
- }
-
- template <class V, class J>
- inline typename vector_iterator<V, std::reverse_iterator<J> >::reference
- vector_iterator<V, std::reverse_iterator<J> >::
- modify (difference_type n) const
- {
- if (v_->_tracking ())
- // Note: going in the opposite direction.
- v_->_impl ().modify (
- static_cast<size_type> (v_->base ().rend () - i_ - 1 - n));
- return i_[n];
- }
}