json icon indicating copy to clipboard operation
json copied to clipboard

Visual Studio 2015 C2664 error std::pair<

Open diegoarranz opened this issue 3 years ago • 1 comments

Description

Dear all,

I am new using Visual Studio 2015 c++ and I would want to use json.hpp file for a little project. I am having an issue C2664 compiling a basic example and I will need your support.

Regards,

Reproduction steps

Open a new console project in Visual Studio 2015. Create and include directory "include" i nthe project. Copy the file json.hpp v 3.11.2. Create a quick example to test all is right. I have the error describe.

Expected vs. actual results

i exepect sucesfful compile but not possible.

Minimal code example

#include "stdafx.h"
#include "resource.h"
#include "include\3.11.2\json.hpp"
#include <iostream>
#include <iomanip>

using json = nlohmann::json;

int main()
{
	std::cout << std::setw(4) << json::meta() << std::endl;
}

Error messages

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2664	'std::pair<std::_Tree_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const StringType,nlohmann::json_abi_v3_11_2::basic_json<std::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_11_2::adl_serializer,std::vector<uint8_t,std::allocator<_Ty>>>>>>>,bool> std::_Tree<std::_Tmap_traits<_Kty,nlohmann::json_abi_v3_11_2::basic_json<std::map,std::vector,StringType,bool,int64_t,uint64_t,double,std::allocator,nlohmann::json_abi_v3_11_2::adl_serializer,std::vector<_Ty,std::allocator<_Ty>>>,_Pr,_Alloc,false>>::emplace<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,nullptr>(std::basic_string<char,std::char_traits<char>,std::allocator<char>> &&,nullptr &&)': cannot convert argument 2 from 'nullptr' to 'nullptr &&'	jsontest	c:\users\diego\documents\visual studio 2015\projects\jsontest\jsontest\include\3.11.2\json.hpp	21298

Compiler and operating system

Visual Studio C++ 2015

Library version

3.11.2

Validation

diegoarranz avatar Dec 05 '22 22:12 diegoarranz

We use MSVC in our CI without problems. To rule out some issues, can you remove the includes for stdafx.h and resource.h and try again?

nlohmann avatar Dec 11 '22 09:12 nlohmann

@diegoarranz Any update?

nlohmann avatar Feb 20 '23 07:02 nlohmann