hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
instanceof.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_COMMON_INSTANCEOF_HPP
7 #define IROHA_COMMON_INSTANCEOF_HPP
8 
9 #include <typeinfo>
10 
11 // check the type of the derived class
12 template <typename Base, typename T>
13 inline bool instanceof (const T *ptr) {
14  return typeid(Base) == typeid(*ptr);
15 }
16 
17 template <typename Base, typename T>
18 inline bool instanceof (const T &ptr) {
19  return typeid(Base) == typeid(ptr);
20 }
21 
22 #endif // IROHA_COMMON_INSTANCEOF_HPP
bool instanceof(const T *ptr)
Definition: instanceof.hpp:13