From 8c257b1754ed55280c39e69a9b83065f4ca7fc80 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 20 Sep 2011 11:53:03 +0200 Subject: Change query syntax to use . for composite and -> for object pointer access Also make non-inverse query columns act as both an object pointer and a normal column. The latter allows us to use natural expressions such as query::employer.is_null (). --- odb/query.hxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/odb/query.hxx b/odb/query.hxx index 82fb411..d89a4e6 100644 --- a/odb/query.hxx +++ b/odb/query.hxx @@ -23,6 +23,24 @@ namespace odb template struct pointer_query_columns; + // Object pointer syntax wrapper. + // + template + struct query_pointer + { + query_pointer () + { + // For some reason GCC needs this dummy c-tor if we make a static + // data member of this type const. + } + + T* + operator-> () const + { + return 0; // All members in T are static. + } + }; + // // template ::kind> -- cgit v1.1