aboutsummaryrefslogtreecommitdiff
path: root/odb/vector-traits.txx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/vector-traits.txx')
-rw-r--r--odb/vector-traits.txx28
1 files changed, 28 insertions, 0 deletions
diff --git a/odb/vector-traits.txx b/odb/vector-traits.txx
index 66f757a..2844633 100644
--- a/odb/vector-traits.txx
+++ b/odb/vector-traits.txx
@@ -5,6 +5,34 @@
namespace odb
{
template <typename V, typename A LIBODB_VECTOR_ARG_DECL>
+ bool access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >::
+ changed (const container_type& c)
+ {
+ // Because modifications can cancel each other (e.g., push and pop),
+ // it is tricky to keep track of whether there are any changes in
+ // the container. Instead, we are just going to examine each element
+ // just like update().
+ //
+
+ // We should either be tracking or summarily changed.
+ //
+ if (c._tracking ())
+ {
+ const vector_impl& impl (c._impl ());
+
+ for (std::size_t i (0), n (impl.size ()); i < n; ++i)
+ {
+ if (impl.state (i) != vector_impl::state_unchanged)
+ return true;
+ }
+ }
+ else
+ return true;
+
+ return false;
+ }
+
+ 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)
{