diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-04 14:55:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-04 14:55:16 +0200 |
commit | 8d402f6711dd63e6b1caa968b14a6aa1321cafef (patch) | |
tree | 83fe569948624cdc5db83a9c0f2ef0ab25667822 | |
parent | eac23648aea3c1aa547dd4bb9872948df49a065a (diff) |
Make sure we detect TR1 pointers when used as wrappers
-rw-r--r-- | odb/relational/processor.cxx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/odb/relational/processor.cxx b/odb/relational/processor.cxx index 68e8ab6..f000858 100644 --- a/odb/relational/processor.cxx +++ b/odb/relational/processor.cxx @@ -1609,7 +1609,6 @@ namespace relational os << f << ":" << l << ":" << c << ": error: " << "wrapper_traits specialization does not define the " << "wrapped_type type" << endl; - throw; } @@ -1659,7 +1658,6 @@ namespace relational os << f << ":" << l << ":" << c << ": error: " << "wrapper_traits specialization does not define the " << "null_handler constant" << endl; - throw; } @@ -1708,11 +1706,39 @@ namespace relational os << f << ":" << l << ":" << c << ": error: " << "wrapper_traits specialization does not define the " << "null_default constant" << endl; - throw; } } + // Check if the wrapper is a TR1 template instantiation. + // + if (tree ti = TYPE_TEMPLATE_INFO (t.tree_node ())) + { + tree decl (TI_TEMPLATE (ti)); // DECL_TEMPLATE + + // Get to the most general template declaration. + // + while (DECL_TEMPLATE_INFO (decl)) + decl = DECL_TI_TEMPLATE (decl); + + bool& tr1 (features.tr1_pointer); + bool& boost (features.boost_pointer); + + string n (decl_as_string (decl, TFF_PLAIN_IDENTIFIER)); + + // In case of a boost TR1 implementation, we cannot distinguish + // between the boost:: and std::tr1:: usage since the latter is + // just a using-declaration for the former. + // + tr1 = tr1 + || n.compare (0, 8, "std::tr1") == 0 + || n.compare (0, 10, "::std::tr1") == 0; + + boost = boost + || n.compare (0, 17, "boost::shared_ptr") == 0 + || n.compare (0, 19, "::boost::shared_ptr") == 0; + } + t.set ("wrapper", true); return true; } |