-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
confirmedkind: bugsolution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)the issue will not be fixed (either it is impossible or deemed out of scope)
Description
The task may like this:
[
{
"id" : "1111-0000",
"content" : []
},
{
"id" : "1111-2222",
"content" : []
}
]when I try to insert json to _task
// nlohmann::json _task;
void add_task(const nlohmann::json& tasks) {
std::lock_guard<std::mutex> lock(_mtx);
_task.insert(_task.end(),tasks.cbegin(),tasks.cend());
}I get this error when using gcc4.8.2 (but worked when using clang3.6)
home/sven/Workspace/Collector/include/json.hpp: In instantiation of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::iterator nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::insert(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::const_iterator, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType>::const_iterator) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberFloatType = double; AllocatorType = std::allocator]’:
/home/sven/Workspace/Collector/Collector/Services/serialize_manager.cpp:46:57: required from here
/home/sven/Workspace/Collector/include/json.hpp:3897:36: error: no match for ‘operator=’ (operand types are ‘std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > >::iterator {aka __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >}’ and ‘void’)
result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator,
^
/home/sven/Workspace/Collector/include/json.hpp:3897:36: note: candidates are:
In file included from /usr/include/c++/4.8.2/bits/stl_algobase.h:67:0,
from /usr/include/c++/4.8.2/bits/char_traits.h:39,
from /usr/include/c++/4.8.2/string:40,
from /home/sven/Workspace/Collector/Collector/Services/serialize_manager.h:8,
from /home/sven/Workspace/Collector/Collector/Services/serialize_manager.cpp:5:
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >& __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >::operator=(const __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&)
class __normal_iterator
^
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘const __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&’
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: note: __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >& __gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >::operator=(__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&&)
/usr/include/c++/4.8.2/bits/stl_iterator.h:708:11: note: no known conversion for argument 1 from ‘void’ to ‘__gnu_cxx::__normal_iterator<nlohmann::basic_json<>*, std::vector<nlohmann::basic_json<>, std::allocator<nlohmann::basic_json<> > > >&&’
gmake[3]: *** [Collector/CMakeFiles/collector.dir/Services/serialize_manager.cpp.o] Error 1
gmake[2]: *** [Collector/CMakeFiles/collector.dir/all] Error 2
gmake[1]: *** [Collector/CMakeFiles/collector.dir/rule] Error 2
gmake: *** [collector] Error 2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
confirmedkind: bugsolution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)the issue will not be fixed (either it is impossible or deemed out of scope)