dune-fem  2.6-git
bartonnackmaninterface.hh
Go to the documentation of this file.
1 #include <dune/common/bartonnackmanifcheck.hh>
2 
3 #ifndef DUNE_FEM_BARTONNACKMANINTERFACE_HH
4 #define DUNE_FEM_BARTONNACKMANINTERFACE_HH
5 
6 #include <type_traits>
7 
8 
9 namespace Dune
10 {
11 
12  namespace Fem
13  {
14 
15  template< class Interface, class Implementation >
17  {
19 
20  public:
22  {
23  static_assert( (std::is_convertible< Interface, ThisType >::value), "Interface must be derived from BartonNackmanInterface." );
24  }
25 
26  protected:
27  static const Implementation &asImp ( const ThisType &other )
28  {
29  return static_cast< const Implementation & >( other );
30  }
31 
32  static Implementation &asImp ( ThisType &other )
33  {
34  return static_cast< Implementation & >( other );
35  }
36 
37  const Implementation &asImp () const
38  {
39  return asImp( *this );
40  }
41 
42  Implementation &asImp ()
43  {
44  return asImp( *this );
45  }
46  };
47 
48  } // namespace Fem
49 
50 } // namespace Dune
51 
52 #endif // #ifndef DUNE_FEM_BARTONNACKMANINTERFACE_HH
Definition: bindguard.hh:11
Definition: bartonnackmaninterface.hh:17
static const Implementation & asImp(const ThisType &other)
Definition: bartonnackmaninterface.hh:27
Implementation & asImp()
Definition: bartonnackmaninterface.hh:42
static Implementation & asImp(ThisType &other)
Definition: bartonnackmaninterface.hh:32
BartonNackmanInterface()
Definition: bartonnackmaninterface.hh:21
const Implementation & asImp() const
Definition: bartonnackmaninterface.hh:37