aboutsummaryrefslogtreecommitdiff
path: root/odb/details/meta/polymorphic-p.hxx
blob: f8113b3aefdbb87cfa449a263833db4decdf6eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// file      : odb/details/meta/polymorphic-p.hxx
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef ODB_DETAILS_META_POLYMORPHIC_HXX
#define ODB_DETAILS_META_POLYMORPHIC_HXX

#include <odb/pre.hxx>

#include <odb/details/meta/class-p.hxx>
#include <odb/details/meta/remove-const-volatile.hxx>

namespace odb
{
  namespace details
  {
    namespace meta
    {
      template <typename CVX>
      struct polymorphic_p
      {
        typedef typename remove_const_volatile<CVX>::result X;

        template <typename Y, bool C>
        struct impl
        {
          static const bool result = false;
        };

        template <typename Y>
        struct impl<Y, true>
        {
          struct t1: Y
          {
            t1 ();
          };

          struct t2: Y
          {
            t2 ();

            virtual
            ~t2 () throw ();
          };

          static const bool result = sizeof (t1) == sizeof (t2);
        };

        static const bool result = impl<X, class_p<X>::result>::result;
      };
    }
  }
}

#include <odb/post.hxx>

#endif // ODB_DETAILS_META_POLYMORPHIC_HXX