aboutsummaryrefslogtreecommitdiff
path: root/odb/meta/polymorphic-p.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:33:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-06-04 16:33:08 +0200
commit6f0d40508286afc8cdd72a0b5f807d5c2a589cfc (patch)
treef22a38560560664cae731c37537c2bb04bffdc2a /odb/meta/polymorphic-p.hxx
parente0f3efd9df3e7eefa06777717f23905022d1949e (diff)
Initial implementation
Diffstat (limited to 'odb/meta/polymorphic-p.hxx')
-rw-r--r--odb/meta/polymorphic-p.hxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/odb/meta/polymorphic-p.hxx b/odb/meta/polymorphic-p.hxx
new file mode 100644
index 0000000..571ef52
--- /dev/null
+++ b/odb/meta/polymorphic-p.hxx
@@ -0,0 +1,51 @@
+// file : odb/meta/polymorphic-p.hxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_META_POLYMORPHIC_HXX
+#define ODB_META_POLYMORPHIC_HXX
+
+#include <odb/meta/class-p.hxx>
+#include <odb/meta/remove-cv.hxx>
+
+namespace odb
+{
+ namespace meta
+ {
+ template <typename CVX>
+ struct polymorphic_p
+ {
+ typedef typename remove_cv<CVX>::r X;
+
+ template <typename Y, bool C>
+ struct impl
+ {
+ static const bool r = false;
+ };
+
+ template <typename Y>
+ struct impl<Y, true>
+ {
+ struct t1: Y
+ {
+ t1 ();
+ };
+
+ struct t2: Y
+ {
+ t2 ();
+
+ virtual
+ ~t2 () throw ();
+ };
+
+ static const bool r = sizeof (t1) == sizeof (t2);
+ };
+
+ static const bool r = impl<X, class_p<X>::r>::r;
+ };
+ }
+}
+
+#endif // ODB_META_POLYMORPHIC_HXX