Vs报错:不存在用户定义的从 “std::vector<Person, std::allocator<Person>>“ 到 “std以及C++中的默认命名空间

在C++编程中遇到VS报错,指出不存在用户定义的从 ""std::vector<Person, std::allocator<Person>>"" 到 ""std"" 的转换。错误源于命名空间的理解和使用。C++的默认命名空间是全局命名空间,类似C语言的编程环境。当在命名空间内访问全局命名空间的元素时,可通过双冒号操作符避免歧义。" 111709182,10502484,使用MVC框架构建超市管理系统——JSP+SQL实践(上),"['jsp', 'sql', 'mysql', 'MVC框架', '超市管理系统']
部署运行你感兴趣的模型镜像

目录

Vs报错:不存在用户定义的从 "std::vector>" 到 "std,>

 C++中默认的命名空间:

C++中默认空间的引用:


Vs报错:不存在用户定义的从 "std::vector<Person, std::allocator<Person>>" 到 "std

迷迷糊糊的写代码的时候,本打算写容器vector存放自定义类型的时候,发现的错误,之前初学类的时候也会出现这个问题,就是把类的声明和定义都放在函数体内。查了资料知道了原因,类是大于函数的:命名空间>类>函数(包括类成员函数和静态函数);具体地说就是cout全名是std::cout(),std就是命名空间,cout是std的函数,using namespace std以后可以直接使用
main是个全局函数,他的命名空间其实是整个程序,student是类,student.show就是类成员函数;

void text01()
{
	class Person {
	private:
		int num;
		string name;
	public:
		Person() {};
		Person(int num, string str)
		{
			this->num = num;
			this->name = name;
		}
	};
	vector<Person> person;
	person.push_back(Person(1,"li"));
	person.push_back(Person(2, "wang"));
	person.push_back(Person(3, "zhang"));
	person.push_back(Person(4, "liu"));
	person.push_back(Person(5, "hei"));
	printfPerson( person);
}
void printfPerson(vector<Person>person)
{

}
int main()
{
	
	return 0;
}

 C++中默认的命名空间:

默认命名空间又称为全局命名空间。典型的默认命名空间就是main()函数,函数或变量没有存放在其他命名空间中,编译器会把它们归类一起组成一个命名空间。假如我们程序一个namespace都没定义,那么所有的变量都会在一个空间中,就是我们C语言的普通编程

C++中默认空间的引用:

要在一个命名空间中访问默认命名空间中的元素,由于默认命名空间没有名字,所以我们之前通过名字引用内部元素显然不适合,编译器给了一个更简单得方法,就是直接省略前面的空间名,直接用双冒号开始访问元素名即可实现。

void cout()
{
	std::cout << "kkk" << endl;
}
void text11()
{
     cout();
}
int main()
{
	text11();
	return 0;
}

当没有加::的时候它会报错说:cout不明确,这个错误也可以理解,毕竟函数名cout本身就在std里面存在,然后现在友定义了一个cout()当它要被调用的时候它不知道该选择哪一个函数,自然报错,我们可以在报错这个cout前面加上::错误就自然解决,原因就是,调用这个cout()的时候选择默认命名空间,不用std命名空间

 

void cout()
{
	std::cout << "kkk" << endl;
}
void text11()
{
     ::cout();
}
int main()
{
	text11();
	return 0;
}

 

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

./22-dp.out config.json 22-dp.out: /home/sxp/projects/22-dp/11-dp/11-dp/../../nlohmann/json.hpp:22278: const value_type& nlohmann::json_abi_v3_12_0::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>::operator[](const typename nlohmann::json_abi_v3_12_0::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>::object_t::key_type&) const [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::json_abi_v3_12_0::adl_serializer; BinaryType = std::vector<unsigned char>; CustomBaseClass = void; nlohmann::json_abi_v3_12_0::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>::const_reference = const nlohmann::json_abi_v3_12_0::basic_json<>&; typename nlohmann::json_abi_v3_12_0::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>::object_t::key_type = std::__cxx11::basic_string<char>; nlohmann::json_abi_v3_12_0::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType, CustomBaseClass>::object_t = std::map<std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_12_0::basic_json<>, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_12_0::basic_json<> > > >]: Assertion `it != m_data.m_value.object->end()' failed. Aborted
10-14
..\..\MainWindow.cpp(16): error C2039: "processButton": 是 "Ui::MainWindow" 的成员 C:\Users\admin\Desktop\QT\untitled1\build\Desktop_Qt_6_10_0_MSVC2022_64bit-Debug\ui_MainWindow.h(64): note: 参见“Ui::MainWindow”的声明 ..\..\MainWindow.cpp(16): error C2027: 使用了未定义类型“QPushButton” C:\Qt\6.10.0\msvc2022_64\include\QtWidgets/qdialog.h(15): note: 参见“QPushButton”的声明 ..\..\MainWindow.cpp(16): error C2065: “clicked”: 未声明的标识符 ..\..\MainWindow.cpp(94): error C2664: “void op::PoseExtractorCaffe::forwardPass(const std::vector<op::Array<float>,std::allocator<op::Array<float>>> &,const op::Point<int> &,const std::vector<_Tp,std::allocator<_Tp>> &,const op::Array<float> &)”: 无法将参数 1 从“std::vector<cv::Mat,std::allocator<cv::Mat>>”转换为“const std::vector<op::Array<float>,std::allocator<op::Array<float>>> &” with [ _Tp=double ] ..\..\MainWindow.cpp(95): note: 原因如下: 无法从“std::vector<cv::Mat,std::allocator<cv::Mat>>”转换为“const std::vector<op::Array<float>,std::allocator<op::Array<float>>>” ..\..\MainWindow.cpp(95): note: 没有可用于执行该转换的用户定义的转换运算符,或者无法调用该运算符 C:\openpose-prosperity\include\openpose/pose/poseExtractorCaffe.hpp(39): note: 参见“op::PoseExtractorCaffe::forwardPass”的声明 ..\..\MainWindow.cpp(94): note: 尝试匹配参数列表“(std::vector<cv::Mat,std::allocator<cv::Mat>>, op::Point<int>)”时 cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -permissive- -Zc:__cplusplus -Zc:externConstexpr -permissive- -Zi -MDd -std:c++17 -utf-8 -W3 -w34100 -w34189 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc /Fddebug\untitled1.vc.pdb -DUNICODE -D_UNICODE -DWIN32 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -DWIN64 -DQT_QML_DEBUG -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I..\..\..\untitled1 -I. -IC:\openpose-prosperity\include -IC:\opencv\build\include -I"C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.44.35207\include" -IC:\Qt\6.10.0\msvc2022_64\include -IC:\Qt\6.10.0\msvc2022_64\include\QtMultimedia -IC:\Qt\6.10.0\msvc2022_64\include\QtWidgets -IC:\Qt\6.10.0\msvc2022_64\include\QtGui -IC:\Qt\6.10.0\msvc2022_64\include\QtNetwork -IC:\Qt\6.10.0\msvc2022_64\include\QtCore -Idebug -I. -I/include -IC:\Qt\6.10.0\msvc2022_64\mkspecs\win32-msvc -Fodebug\ @C:\Users\admin\AppData\Local\Temp\moc_MainWindow.obj.7660.891.jom moc_MainWindow.cpp jom: C:\Users\admin\Desktop\QT\untitled1\build\Desktop_Qt_6_10_0_MSVC2022_64bit-Debug\Makefile.Debug [debug\MainWindow.obj] Error 2 jom: C:\Users\admin\Desktop\QT\untitled1\build\Desktop_Qt_6_10_0_MSVC2022_64bit-Debug\Makefile [debug] Error 2 00:38:28: The command "C:\Qt\Tools\QtCreator\bin\jom\jom.exe" terminated with exit code 2. 00:38:28: Error while building/deploying project untitled1 (kit: Desktop Qt 6.10.0 MSVC2022 64bit) 00:38:28: The kit Desktop Qt 6.10.0 MSVC2022 64bit has configuration issues which might be the root cause for this problem. 00:38:28: When executing step "Make" 00:38:28: Elapsed time: 00:06.
11-22
/tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c: In function 'int main()': /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:17:26: error: no matching function for call to 'size(int [(<anonymous> + 1)])' 17 | for(int i=1;i<=size(a);i++) | ^ In file included from /usr/include/c++/9/string:54, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/range_access.h:242:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 242 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ /usr/include/c++/9/bits/range_access.h:242:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:17:26: note: variable-sized array type 'int [(<anonymous> + 1)]' is not a valid template argument 17 | for(int i=1;i<=size(a);i++) | ^ In file included from /usr/include/c++/9/string:54, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/range_access.h:252:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 252 | size(const _Tp (&/*__array*/)[_Nm]) noexcept | ^~~~ /usr/include/c++/9/bits/range_access.h:252:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:17:26: note: variable-sized array type 'long int' is not a valid template argument 17 | for(int i=1;i<=size(a);i++) | ^ /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:13: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 19 | cout>>a[i]; | ~~~~^~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:13: note: candidate: 'operator>>(int, int)' <built-in> 19 | cout>>a[i]; | ~~~~^~~~~~ /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:13: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/9/string:56, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/basic_string.tcc:1466:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1466 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.tcc:1466:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/istream:991, from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/istream.tcc:931:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)' 931 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/9/bits/istream.tcc:931:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:756:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)' 756 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/9/istream:756:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:761:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)' 761 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/9/istream:761:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/istream:991, from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/istream.tcc:963:5: note: candidate: 'template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)' 963 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/9/bits/istream.tcc:963:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:803:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)' 803 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/9/istream:803:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:808:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)' 808 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/9/istream:808:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout>>a[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:980:5: note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)' 980 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/9/istream:980:5: note: template argument deduction/substitution failed: /usr/include/c++/9/istream: In substitution of 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:19:18: required from here /usr/include/c++/9/istream:980:5: error: no type named 'type' in 'struct std::enable_if<false, void>' /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:21:30: error: no matching function for call to 'size(int [(<anonymous> + 1)])' 21 | for(int i=1;i<=size(b);i++) | ^ In file included from /usr/include/c++/9/string:54, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/range_access.h:242:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 242 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ /usr/include/c++/9/bits/range_access.h:242:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:21:30: note: variable-sized array type 'int [(<anonymous> + 1)]' is not a valid template argument 21 | for(int i=1;i<=size(b);i++) | ^ In file included from /usr/include/c++/9/string:54, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/range_access.h:252:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 252 | size(const _Tp (&/*__array*/)[_Nm]) noexcept | ^~~~ /usr/include/c++/9/bits/range_access.h:252:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:21:30: note: variable-sized array type 'long int' is not a valid template argument 21 | for(int i=1;i<=size(b);i++) | ^ /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:13: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 23 | cout>>b[i]; | ~~~~^~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:13: note: candidate: 'operator>>(int, int)' <built-in> 23 | cout>>b[i]; | ~~~~^~~~~~ /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:13: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/9/string:56, from /usr/include/c++/9/bits/locale_classes.h:40, from /usr/include/c++/9/bits/ios_base.h:41, from /usr/include/c++/9/ios:42, from /usr/include/c++/9/ostream:38, from /usr/include/c++/9/iostream:39, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/basic_string.tcc:1466:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 1466 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/9/bits/basic_string.tcc:1466:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/istream:991, from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/istream.tcc:931:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT&)' 931 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/9/bits/istream.tcc:931:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:756:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&)' 756 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/9/istream:756:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:761:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char&)' 761 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/9/istream:761:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/istream:991, from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/bits/istream.tcc:963:5: note: candidate: 'template<class _CharT2, class _Traits2> std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, _CharT2*)' 963 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/9/bits/istream.tcc:963:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:803:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char*)' 803 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/9/istream:803:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:808:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, signed char*)' 808 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/9/istream:808:5: note: template argument deduction/substitution failed: /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 23 | cout>>b[i]; | ^ In file included from /usr/include/c++/9/iostream:40, from /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:1: /usr/include/c++/9/istream:980:5: note: candidate: 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&)' 980 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/9/istream:980:5: note: template argument deduction/substitution failed: /usr/include/c++/9/istream: In substitution of 'template<class _Istream, class _Tp> typename std::enable_if<std::__and_<std::__not_<std::is_lvalue_reference<_Tp> >, std::__is_convertible_to_basic_istream<_Istream>, std::__is_extractable<typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type, _Tp&&, void> >::value, typename std::__is_convertible_to_basic_istream<_Tp>::__istream_type>::type std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': /tmp/cca6ccd2a78d4e09be0558c2ecdbdc5a/main.c:23:18: required from here /usr/include/c++/9/istream:980:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
07-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值