xtd 0.2.0
unregister_any_stringer.h
Go to the documentation of this file.
1 #pragma once
4 #include "any.h"
5 #include <functional>
6 #include <string>
7 #include <typeindex>
8 #include <typeinfo>
9 #include <type_traits>
10 #include <unordered_map>
11 #include <vector>
12 
14 extern std::unordered_map<std::type_index, std::function<std::string(std::any const&)>> __any_stringer__;
16 
18 namespace xtd {
30  template<class type_t>
31  inline void unregister_any_stringer() {
32  auto it = __any_stringer__.find(std::type_index(typeid(type_t)));
33  if (it != __any_stringer__.cend()) __any_stringer__.erase(it);
34  }
35 }
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Contains std::any type and std::bad_any_cast exception.
void unregister_any_stringer()
Unregister an any stringer method for a specified type.
Definition: unregister_any_stringer.h:31