From c31fc72be48b037fff1cc2b46a812d20d4b601c4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Mar 2011 11:07:43 +0200 Subject: Cache current context in static variable --- odb/relational/context.hxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'odb/relational/context.hxx') diff --git a/odb/relational/context.hxx b/odb/relational/context.hxx index fbd6059..c99b400 100644 --- a/odb/relational/context.hxx +++ b/odb/relational/context.hxx @@ -33,15 +33,6 @@ namespace relational string quote_id (string const&) const; - public: - context (); - - static context& - current () - { - return dynamic_cast (root_context::current ()); - } - protected: // The default implementation returns false. // @@ -61,12 +52,26 @@ namespace relational virtual string quote_id_impl (string const&) const; + public: + virtual + ~context (); + context (); + + static context& + current () + { + return *current_; + } + protected: struct data; typedef context base_context; context (data*); + private: + static context* current_; + protected: struct data: root_context::data { -- cgit v1.1