-
-
Save fabiogaluppo/812f6453072c97983fed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unordered_map> | |
template <typename TKey, typename TValue> | |
inline std::unordered_map<TKey, TValue> make_dic(typename std::unordered_map<TKey, TValue>::size_type capacity) | |
{ | |
return std::unordered_map<TKey, TValue>(capacity); | |
} | |
... | |
auto dic = make_dic<std::string, std::string>(1024); | |
//better than: | |
//std::unordered_map<std::string, std::string> dic = make_dic<std::string, std::string>(1024); | |
std::cout << (typeid(dic).name()) << "\n"; //class std::unordered_map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::hash<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,struct std::equal_to<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment