From 8d402f6711dd63e6b1caa968b14a6aa1321cafef Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 4 Oct 2012 14:55:16 +0200 Subject: Make sure we detect TR1 pointers when used as wrappers --- odb/relational/processor.cxx | 32 +++++++++++++++++++++++++++++--- 1 file 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; } -- cgit v1.1