partially fix clang compilation

Missing header and mistaken algorithm usage.

Also removed it name from range loops. It's not correct.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-06-15 13:49:50 -07:00
parent 6387cbc0ca
commit a25ce85c28
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
3 changed files with 20 additions and 15 deletions

View File

@ -225,8 +225,8 @@ template <typename K, typename V, typename C, typename A>
struct convert<std::map<K, V, C, A>> { struct convert<std::map<K, V, C, A>> {
static Node encode(const std::map<K, V, C, A>& rhs) { static Node encode(const std::map<K, V, C, A>& rhs) {
Node node(NodeType::Map); Node node(NodeType::Map);
for (const auto& it : rhs) for (const auto& element : rhs)
node.force_insert(it.first, it.second); node.force_insert(element.first, element.second);
return node; return node;
} }
@ -235,12 +235,12 @@ struct convert<std::map<K, V, C, A>> {
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& it : node) for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs[it.first.template as<K>()] = it.second.template as<V>(); rhs[element.first.template as<K>()] = element.second.template as<V>();
#else #else
rhs[it.first.as<K>()] = it.second.as<V>(); rhs[element.first.as<K>()] = element.second.as<V>();
#endif #endif
return true; return true;
} }
@ -251,7 +251,8 @@ template <typename T, typename A>
struct convert<std::vector<T, A>> { struct convert<std::vector<T, A>> {
static Node encode(const std::vector<T, A>& rhs) { static Node encode(const std::vector<T, A>& rhs) {
Node node(NodeType::Sequence); Node node(NodeType::Sequence);
std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); for (const auto& element : rhs)
node.push_back(element);
return node; return node;
} }
@ -260,12 +261,12 @@ struct convert<std::vector<T, A>> {
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& it : node) for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs.push_back(it.template as<T>()); rhs.push_back(element.template as<T>());
#else #else
rhs.push_back(it.as<T>()); rhs.push_back(element.as<T>());
#endif #endif
return true; return true;
} }
@ -276,7 +277,8 @@ template <typename T, typename A>
struct convert<std::list<T,A>> { struct convert<std::list<T,A>> {
static Node encode(const std::list<T,A>& rhs) { static Node encode(const std::list<T,A>& rhs) {
Node node(NodeType::Sequence); Node node(NodeType::Sequence);
std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); for (const auto& element : rhs)
node.push_back(element);
return node; return node;
} }
@ -285,12 +287,12 @@ struct convert<std::list<T,A>> {
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& it : node) for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs.push_back(it.template as<T>()); rhs.push_back(element.template as<T>());
#else #else
rhs.push_back(it.as<T>()); rhs.push_back(element.as<T>());
#endif #endif
return true; return true;
} }
@ -301,7 +303,9 @@ template <typename T, std::size_t N>
struct convert<std::array<T, N>> { struct convert<std::array<T, N>> {
static Node encode(const std::array<T, N>& rhs) { static Node encode(const std::array<T, N>& rhs) {
Node node(NodeType::Sequence); Node node(NodeType::Sequence);
std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); for (const auto& element : rhs) {
node.push_back(element);
}
return node; return node;
} }

View File

@ -158,7 +158,7 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
}); });
if (it != m_map.end()) { if (it != m_map.end()) {
return it->second; return *it->second;
} }
node& k = convert_to_node(key, pMemory); node& k = convert_to_node(key, pMemory);

View File

@ -1,3 +1,4 @@
#include <algorithm>
#include <cassert> #include <cassert>
#include <iterator> #include <iterator>
#include <sstream> #include <sstream>