extracted crtp code to a separate class
This commit is contained in:
parent
a4d06be903
commit
2c9625e480
18
utils/crtp.hpp
Normal file
18
utils/crtp.hpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#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
|
Loading…
Reference in New Issue
Block a user