aboutsummaryrefslogtreecommitdiff
path: root/odb/vector-impl.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:15:26 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-11 16:15:26 +0200
commitb2f552f3505c1d8247e1a0ca844fe372ef639f79 (patch)
tree2e46697657144f9b965ffddc04ceba0750294164 /odb/vector-impl.ixx
parentc6bc6ecf14ba7b43350a65df9701b0848c95d0e2 (diff)
Rearrange inline function order to help MinGW2.4.0
On MinGW, if a DLL-exported inline function is called before it is known to be inline, the compiler issues a warning.
Diffstat (limited to 'odb/vector-impl.ixx')
-rw-r--r--odb/vector-impl.ixx78
1 files changed, 50 insertions, 28 deletions
diff --git a/odb/vector-impl.ixx b/odb/vector-impl.ixx
index 595c5ef..4865dd2 100644
--- a/odb/vector-impl.ixx
+++ b/odb/vector-impl.ixx
@@ -100,6 +100,16 @@ namespace odb
}
inline void vector_impl::
+ set (std::size_t i, element_state_type s)
+ {
+ std::size_t r (i % 4);
+ i /= 4;
+ unsigned char v (static_cast<unsigned char> (s));
+ v <<= shift_[r];
+ data_[i] = (data_[i] & ~mask_[r]) | v;
+ }
+
+ inline void vector_impl::
modify (std::size_t i, std::size_t n)
{
for (; n != 0; --n, ++i)
@@ -125,18 +135,37 @@ namespace odb
push_back (n - tail_);
}
- inline void vector_impl::
- set (std::size_t i, element_state_type s)
+ // vector_base
+ //
+ inline vector_base::
+ ~vector_base ()
{
- std::size_t r (i % 4);
- i /= 4;
- unsigned char v (static_cast<unsigned char> (s));
- v <<= shift_[r];
- data_[i] = (data_[i] & ~mask_[r]) | v;
+ if (tran_ != 0)
+ tran_->callback_unregister (this);
+ }
+
+ inline vector_base::
+ vector_base (): tran_ (0) {}
+
+ inline vector_base::
+ vector_base (const vector_base& x)
+ : impl_ (x.impl_), tran_ (0)
+ {
+ // If the original is armed, then arm ourselves as well.
+ //
+ if (x.tran_ != 0)
+ _arm (*x.tran_);
+ }
+
+ inline void vector_base::
+ swap (vector_base& x)
+ {
+ impl_.swap (x.impl_);
+
+ if (tran_ != 0 || x.tran_ != 0)
+ swap_tran (x);
}
- // vector_base
- //
#ifdef ODB_CXX11
inline vector_base::
vector_base (vector_base&& x)
@@ -151,32 +180,25 @@ namespace odb
#endif
inline void vector_base::
- _arm (transaction& t) const
+ _stop () const
{
- tran_ = &t;
- t.callback_register (&rollback,
- const_cast<vector_base*> (this),
- transaction::event_rollback,
- 0,
- &tran_);
+ impl_.stop ();
}
- inline vector_base::
- vector_base (const vector_base& x)
- : impl_ (x.impl_), tran_ (0)
+ inline bool vector_base::
+ _tracking () const
{
- // If the original is armed, then arm ourselves as well.
- //
- if (x.tran_ != 0)
- _arm (*x.tran_);
+ return impl_.tracking ();
}
inline void vector_base::
- swap (vector_base& x)
+ _arm (transaction& t) const
{
- impl_.swap (x.impl_);
-
- if (tran_ != 0 || x.tran_ != 0)
- swap_tran (x);
+ tran_ = &t;
+ t.callback_register (&rollback,
+ const_cast<vector_base*> (this),
+ transaction::event_rollback,
+ 0,
+ &tran_);
}
}