| 105 | |
| 106 | template <typename KeyT> |
| 107 | std::string key_to_string(const KeyT& key) { |
| 108 | if constexpr (std::is_same_v<KeyT, std::string>) { |
| 109 | return key; |
| 110 | } else { |
| 111 | return std::to_string(key); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | // Convert from a string to a key. For non-string types, we assume numeric keys. |
| 116 | template <typename KeyT, typename std::enable_if<!is_std_tuple<KeyT>::value, int>::type = 0> |