aboutsummaryrefslogtreecommitdiff
path: root/common/container/test.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-24 10:18:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-24 10:18:09 +0200
commit0799760700c288939bc39ad43f3e167d42406df5 (patch)
tree97760c1568657196a3bdc57b97030d15025da4ea /common/container/test.hxx
parent17d444a90d5ab7e4333bf4d17a9a0a3d35104ba4 (diff)
Add support for unordered storage of ordered containers
New pragma: unordered.
Diffstat (limited to 'common/container/test.hxx')
-rw-r--r--common/container/test.hxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/common/container/test.hxx b/common/container/test.hxx
index a12be5c..1f565cd 100644
--- a/common/container/test.hxx
+++ b/common/container/test.hxx
@@ -10,7 +10,6 @@
#include <set>
#include <list>
#include <vector>
-
#include <string>
#include <odb/core.hxx>
@@ -96,6 +95,9 @@ struct object
#pragma db value_column("")
comp_vector cv;
+ #pragma db unordered
+ num_vector uv;
+
// list
//
#pragma db transient
@@ -120,6 +122,17 @@ struct object
inline bool
operator== (const object& x, const object& y)
{
+ if (x.uv.size () != y.uv.size ())
+ return false;
+
+ int xs (0), ys (0);
+
+ for (num_vector::size_type i (0); i < x.uv.size (); ++i)
+ {
+ xs += x.uv[i];
+ ys += y.uv[i];
+ }
+
return
x.id_ == y.id_ &&
x.num == y.num &&
@@ -130,6 +143,7 @@ operator== (const object& x, const object& y)
x.nv == y.nv &&
x.sv == y.sv &&
x.cv == y.cv &&
+ xs == ys &&
x.sl == y.sl &&