diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-28 11:39:17 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-08-28 14:15:45 +0200 |
commit | 475a7c89e1c858ae8fec466670af4628129a42d4 (patch) | |
tree | 371d7084250767ae927e685fb7a5da630626280f /odb/context.hxx | |
parent | 64d0ceffaaf5f57a3d24a5210bf0ad2a8474a618 (diff) |
Add wrapper support for containers
Diffstat (limited to 'odb/context.hxx')
-rw-r--r-- | odb/context.hxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/odb/context.hxx b/odb/context.hxx index 3a09805..6449daf 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -132,6 +132,19 @@ public: return t.count ("container-kind"); } + // As above but also "sees through" wrappers. Returns the actual + // container type or NULL if not a container. + // + static semantics::type* + container_wrapper (semantics::type& t) + { + if (container (t)) + return &t; + else if (semantics::type* wt = wrapper (t)) + return container (*wt) ? wt : 0; + else return 0; + } + static semantics::class_* object_pointer (semantics::type& t) { @@ -320,7 +333,13 @@ public: static bool unordered (semantics::data_member& m) { - return m.count ("unordered") || m.type ().count ("unordered"); + if (m.count ("unordered")) + return true; + + if (semantics::type* c = container_wrapper (m.type ())) + return c->count ("unordered"); + + return false; } // The 'is a' and 'has a' tests. The has_a test currently does not |