From 9ac9bb98f307156c02fa19ea747cf5eb1d2dcadf Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 4 Aug 2011 13:29:42 +0200 Subject: Add support for value wrappers Wrapper is a class that wraps another type. Examples of wrappers are various smart pointers, holders, etc. A wrapper can be transparent or it can handle the NULL semantics. The new odb::nullable class template is a NULL wrapper that helps to add the NULL semantics to a value type. New test: common/wrapper. --- odb/details/wrapper-p.hxx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 odb/details/wrapper-p.hxx (limited to 'odb/details') diff --git a/odb/details/wrapper-p.hxx b/odb/details/wrapper-p.hxx new file mode 100644 index 0000000..7736fc9 --- /dev/null +++ b/odb/details/wrapper-p.hxx @@ -0,0 +1,40 @@ +// file : odb/details/wrapper-p.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_DETAILS_WRAPPER_P_HXX +#define ODB_DETAILS_WRAPPER_P_HXX + +#include + +#include + +#include + +namespace odb +{ + namespace details + { + // GCC doesn't like these to be inside wrapper_p. + // + template + meta::no + wrapper_p_test (...); + + template + meta::yes + wrapper_p_test (typename wrapper_traits::wrapped_type*); + + template + struct wrapper_p + { + static const bool r = + sizeof (wrapper_p_test (0)) == sizeof (meta::yes); + }; + } +} + +#include + +#endif // ODB_DETAILS_WRAPPER_P_HXX -- cgit v1.1