19 lines
323 B
C++
19 lines
323 B
C++
|
#ifndef MEMGRAPH_UTILS_CRTP_HPP
|
||
|
#define MEMGRAPH_UTILS_CRTP_HPP
|
||
|
|
||
|
// a helper class for implementing static casting to a derived class using the
|
||
|
// curiously recurring template pattern
|
||
|
|
||
|
template <class Derived>
|
||
|
class Crtp
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
Derived& derived()
|
||
|
{
|
||
|
return *static_cast<Derived*>(this);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif
|