Skip to content

Commit

Permalink
Fix compilation error with NVCC (#3234)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann authored Jan 2, 2022
1 parent 926df56 commit b69713c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/nlohmann/ordered_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
using key_type = Key;
using mapped_type = T;
using Container = std::vector<std::pair<const Key, T>, Allocator>;
using typename Container::iterator;
using typename Container::const_iterator;
using typename Container::size_type;
using typename Container::value_type;
using iterator = typename Container::iterator;
using const_iterator = typename Container::const_iterator;
using size_type = typename Container::size_type;
using value_type = typename Container::value_type;

// Explicit constructors instead of `using Container::Container`
// otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)
Expand Down
8 changes: 4 additions & 4 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17041,10 +17041,10 @@ template <class Key, class T, class IgnoredLess = std::less<Key>,
using key_type = Key;
using mapped_type = T;
using Container = std::vector<std::pair<const Key, T>, Allocator>;
using typename Container::iterator;
using typename Container::const_iterator;
using typename Container::size_type;
using typename Container::value_type;
using iterator = typename Container::iterator;
using const_iterator = typename Container::const_iterator;
using size_type = typename Container::size_type;
using value_type = typename Container::value_type;

// Explicit constructors instead of `using Container::Container`
// otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4)
Expand Down
4 changes: 4 additions & 0 deletions test/cuda_example/json_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ int main()
{
nlohmann::ordered_json json = {"Test"};
json.dump();

// regression for #3013 (ordered_json::reset() compile error with nvcc)
nlohmann::ordered_json metadata;
metadata.erase("key");
}

0 comments on commit b69713c

Please sign in to comment.