maybeCastObj.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Common_detail_maybeCastObj_h
2 #define canvas_Persistency_Common_detail_maybeCastObj_h
3 
4 #include <typeinfo>
5 
6 namespace art::detail {
7  bool upcastAllowed(std::type_info const& tiFrom, std::type_info const& tiTo);
8  void const* maybeCastObj(void const* address,
9  std::type_info const& tiFrom,
10  std::type_info const& tiTo);
11  template <typename element_type>
12  void const* maybeCastObj(element_type const* address,
13  std::type_info const& tiTo);
14 }
15 
16 template <class element_type>
17 inline void const*
18 art::detail::maybeCastObj(element_type const* address,
19  std::type_info const& tiTo)
20 {
21  static std::type_info const& tiFrom{typeid(element_type)};
22  return maybeCastObj(address, tiFrom, tiTo);
23 }
24 
25 #endif /* canvas_Persistency_Common_detail_maybeCastObj_h */
26 
27 // Local Variables:
28 // mode: c++
29 // End:
bool upcastAllowed(std::type_info const &tiFrom, std::type_info const &tiTo)
void const * maybeCastObj(void const *address, std::type_info const &tiFrom, std::type_info const &tiTo)