Skip to content

Commit b69713c

Browse files
authored
Fix compilation error with NVCC (#3234)
1 parent 926df56 commit b69713c

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

include/nlohmann/ordered_map.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
2323
using key_type = Key;
2424
using mapped_type = T;
2525
using Container = std::vector<std::pair<const Key, T>, Allocator>;
26-
using typename Container::iterator;
27-
using typename Container::const_iterator;
28-
using typename Container::size_type;
29-
using typename Container::value_type;
26+
using iterator = typename Container::iterator;
27+
using const_iterator = typename Container::const_iterator;
28+
using size_type = typename Container::size_type;
29+
using value_type = typename Container::value_type;
3030

3131
// Explicit constructors instead of `using Container::Container`
3232
// otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)

single_include/nlohmann/json.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -17041,10 +17041,10 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
1704117041
using key_type = Key;
1704217042
using mapped_type = T;
1704317043
using Container = std::vector<std::pair<const Key, T>, Allocator>;
17044-
using typename Container::iterator;
17045-
using typename Container::const_iterator;
17046-
using typename Container::size_type;
17047-
using typename Container::value_type;
17044+
using iterator = typename Container::iterator;
17045+
using const_iterator = typename Container::const_iterator;
17046+
using size_type = typename Container::size_type;
17047+
using value_type = typename Container::value_type;
1704817048

1704917049
// Explicit constructors instead of `using Container::Container`
1705017050
// otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)

test/cuda_example/json_cuda.cu

+4
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ int main()
44
{
55
nlohmann::ordered_json json = {"Test"};
66
json.dump();
7+
8+
// regression for #3013 (ordered_json::reset() compile error with nvcc)
9+
nlohmann::ordered_json metadata;
10+
metadata.erase("key");
711
}

0 commit comments

Comments
 (0)