DUNE-FEM (unstable)

bartonnackmaninterface.hh
2
3#ifndef DUNE_FEM_BARTONNACKMANINTERFACE_HH
4#define DUNE_FEM_BARTONNACKMANINTERFACE_HH
5
6#include <type_traits>
7
8
9namespace Dune
10{
11
12 namespace Fem
13 {
14
15 template< class Interface, class Implementation >
16 class BartonNackmanInterface
17 {
18 typedef BartonNackmanInterface< Interface, Implementation > ThisType;
19
20 public:
21 BartonNackmanInterface ()
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
Provides check for implementation of interface methods when using static polymorphism,...
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)