Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error getting a std::pair<> on latest VS 2017 compiler #1506

Closed
pmhpereira opened this issue Mar 7, 2019 · 1 comment
Closed

Comments

@pmhpereira
Copy link

pmhpereira commented Mar 7, 2019

  • What is the issue you have?
    Compilation error on latest Visual Studio 2017 compiler.
    Works with Visual Studio 2015 compiler.
error C2679: binary '=': no operator found which takes a right-hand operand of type 
'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>' 
(or there is no acceptable conversion)
  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?
int main()
{
    nlohmann::json jsonTest;

    std::pair<int, int> intPair(10, 20);

    jsonTest["intPair"] = intPair;
    intPair = jsonTest["intPair"]; // compilation error on this line
}
  • What is the expected behavior?
    Same as intPair = jsonTest["intPair"].get<std::pair<int,int>>();

  • Which compiler and operating system are you using? Is it a supported compiler?
    -- Building for: Visual Studio 15 2017
    -- The CXX compiler identification is MSVC 19.16.27027.1
    -- Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
    -- Windows 10

  • Did you use a released version of the library or the version from the develop branch?
    Release v3.5.0

  • If you experience a compilation error: can you compile and run the unit tests?
    Can compile. No errors.

@pmhpereira pmhpereira changed the title Compilation error getting a std::pairt<T1, T2> on latest VS 2017 Compilation error getting a std::pair<T1, T2> on latest VS 2017 Mar 7, 2019
@pmhpereira pmhpereira changed the title Compilation error getting a std::pair<T1, T2> on latest VS 2017 Compilation error getting a std::pair<> on latest VS 2017 compiler Mar 7, 2019
@pmhpereira
Copy link
Author

Nevermind. Just found out about #958.
Will update all the code to start using .get<>() instead!
Thank you for this great lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant