aboutsummaryrefslogtreecommitdiff
path: root/common/inheritance/test.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-25 12:30:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-25 12:30:05 +0200
commit5f821d47f0ee08a3a08962d0dc641326618dbf50 (patch)
treeb955615d73f182344ef59c624b1521d3c80302ec /common/inheritance/test.hxx
parentbcdc344dbf45e16ed99960dcd6392bd325ee15c1 (diff)
Reuse container traits from composite values
Diffstat (limited to 'common/inheritance/test.hxx')
-rw-r--r--common/inheritance/test.hxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/common/inheritance/test.hxx b/common/inheritance/test.hxx
index e27ff7a..31ef9c1 100644
--- a/common/inheritance/test.hxx
+++ b/common/inheritance/test.hxx
@@ -12,7 +12,19 @@
#include <odb/core.hxx>
#pragma db value
-struct comp
+struct comp_base
+{
+ std::vector<unsigned char> bools;
+
+ bool
+ operator== (const comp_base& y) const
+ {
+ return bools == y.bools;
+ }
+};
+
+#pragma db value
+struct comp: comp_base
{
unsigned int num;
std::string str;
@@ -22,7 +34,11 @@ struct comp
bool
operator== (const comp& y) const
{
- return num == y.num && str == y.str && nums == y.nums;
+ return
+ static_cast<const comp_base&> (*this) == y &&
+ num == y.num &&
+ str == y.str &&
+ nums == y.nums;
}
};