R
Rhiner Dan
Here are the errors from my Dev-c compiler
////////////////////////////////////////////////////////////////////////////
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c Tests.cpp -o Tests.o
-I"C:/Dev-Cpp/include/c++/3.3.1"
-I"C:/Dev-Cpp/include/c++/3.3.1/mingw32"
-I"C:/Dev-Cpp/include/c++/3.3.1/backward"
-I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include"
-I"C:/Dev-Cpp/include"
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h: In constructor
`std:air<_T1,
_T2>:air(const std:air<_U1, _U2>&) [with _U1 =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _U2 =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _T1 = std::string*, _T2 =
std::string*]':
Tests.cpp:59: instantiated from here
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h:88: error: cannot convert
`const
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >' to `std::string*' in
initialization
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h:88: error: cannot convert
`const
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >' to `std::string*' in
initialization
make.exe: *** [Tests.o] Error 1
Execution terminated
//////////////////////////////////////////////////////////////////////////////
And here is the code that emits those errors
// input strings and save them into vector of strings called str.
// begin to fetch from here.
while(std::getline(std::cin,hold)){
std:air<std::string*, std::string*>
result=std::equal_range(str.begin(),str.end(), hold);
std::cout<<"the fresult is: "<<*result.first<<'\n';
std::cout<<"the lresult is: "<<*result.second<<'\n';
}
Using string pointers in pair<> like those above are not allowed right
?
I tested input string source code and compiler said it was correctly
witten but the above code gave errors..I am new to stl, Please
help..Thank you in advance.
////////////////////////////////////////////////////////////////////////////
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -c Tests.cpp -o Tests.o
-I"C:/Dev-Cpp/include/c++/3.3.1"
-I"C:/Dev-Cpp/include/c++/3.3.1/mingw32"
-I"C:/Dev-Cpp/include/c++/3.3.1/backward"
-I"C:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include"
-I"C:/Dev-Cpp/include"
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h: In constructor
`std:air<_T1,
_T2>:air(const std:air<_U1, _U2>&) [with _U1 =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _U2 =
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >, _T1 = std::string*, _T2 =
std::string*]':
Tests.cpp:59: instantiated from here
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h:88: error: cannot convert
`const
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >' to `std::string*' in
initialization
C:/Dev-Cpp/include/c++/3.3.1/bits/stl_pair.h:88: error: cannot convert
`const
__gnu_cxx::__normal_iterator<std::string*, std::vector<std::string,
std::allocator<std::string> > >' to `std::string*' in
initialization
make.exe: *** [Tests.o] Error 1
Execution terminated
//////////////////////////////////////////////////////////////////////////////
And here is the code that emits those errors
// input strings and save them into vector of strings called str.
// begin to fetch from here.
while(std::getline(std::cin,hold)){
std:air<std::string*, std::string*>
result=std::equal_range(str.begin(),str.end(), hold);
std::cout<<"the fresult is: "<<*result.first<<'\n';
std::cout<<"the lresult is: "<<*result.second<<'\n';
}
Using string pointers in pair<> like those above are not allowed right
?
I tested input string source code and compiler said it was correctly
witten but the above code gave errors..I am new to stl, Please
help..Thank you in advance.