CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CRTPBase.hh
Go to the documentation of this file.
1 #ifndef CASM_CRTPBase
2 #define CASM_CRTPBase
3 
4 namespace notstd {
5 
7 template <typename _MostDerived>
8 class CRTPBase {
9  public:
10  typedef _MostDerived MostDerived;
11 
12  protected:
13  MostDerived &derived() { return *static_cast<MostDerived *>(this); }
14 
15  const MostDerived &derived() const {
16  return *static_cast<const MostDerived *>(this);
17  }
18 };
19 } // namespace notstd
20 
21 namespace CASM {
22 
23 template <typename MostDerived>
25 
26 namespace CASM_TMP {
27 template <typename MostDerived>
29 }
30 } // namespace CASM
31 
32 #endif
Base class for CRTP pattern.
Definition: CRTPBase.hh:8
MostDerived & derived()
Definition: CRTPBase.hh:13
_MostDerived MostDerived
Definition: CRTPBase.hh:10
const MostDerived & derived() const
Definition: CRTPBase.hh:15
Main CASM namespace.
Definition: APICommand.hh:8
Non-std smart pointer classes and functions.