473,800 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting lower-bound and upper-bound of strings input

Here are the errors from my Dev-c compiler

////////////////////////////////////////////////////////////////////////////
Building Makefile: "C:\Dev-Cpp\Makefile.wi n"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.wi n" 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::pair<_T1,
_T2>::pair(cons t std::pair<_U1, _U2>&) [with _U1 =
__gnu_cxx::__no rmal_iterator<s td::string*, std::vector<std ::string,

std::allocator< std::string> > >, _U2 =
__gnu_cxx::__no rmal_iterator<s td::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::__no rmal_iterator<s td::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::__no rmal_iterator<s td::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::getl ine(std::cin,ho ld)){
std::pair<std:: string*, std::string*>
result=std::equ al_range(str.be gin(),str.end() , hold);
std::cout<<"the fresult is: "<<*result.firs t<<'\n';
std::cout<<"the lresult is: "<<*result.seco nd<<'\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.
Jul 23 '05 #1
1 4815

"Rhiner Dan" <st****@central pets.com> wrote in message
news:f5******** *************** ***@posting.goo gle.com...
Here are the errors from my Dev-c compiler

////////////////////////////////////////////////////////////////////////////
Building Makefile: "C:\Dev-Cpp\Makefile.wi n"
Executing make...
make.exe -f "C:\Dev-Cpp\Makefile.wi n" 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::pair<_T1,
_T2>::pair(cons t std::pair<_U1, _U2>&) [with _U1 =
__gnu_cxx::__no rmal_iterator<s td::string*, std::vector<std ::string,

std::allocator< std::string> > >, _U2 =
__gnu_cxx::__no rmal_iterator<s td::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::__no rmal_iterator<s td::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::__no rmal_iterator<s td::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::getl ine(std::cin,ho ld)){
std::pair<std:: string*, std::string*>
result=std::equ al_range(str.be gin(),str.end() , hold);
std::cout<<"the fresult is: "<<*result.firs t<<'\n';
std::cout<<"the lresult is: "<<*result.seco nd<<'\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.


#include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>

int main()
{
std::vector<std ::string> str;
std::string hold;

while(std::getl ine(std::cin, hold))
{
std::pair<std:: vector<std::str ing>::iterator,
std::vector<std ::string>::iter ator>
result(std::equ al_range(str.be gin(),
str.end(),
hold));

std::cout << "the fresult is: " << *result.first << '\n';
std::cout << "the lresult is: " << *result.second << '\n';
}

return 0;
}

-Mike
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1404
by: Ramesh | last post by:
Hello, i am trying to run visual studio.NEt on my XP Laptop. i am getting an exception. thats says overflow/underflow error. i am unable to use any controls. can u help please. thanks
2
3210
by: gf gf | last post by:
I read that lower() is deprecated. Unfortunately, I can't find the preferred way of lowercasing a string. What is it? Thanks PS Please cc me on all responses.
3
2771
by: Ron | last post by:
I've written a screen saver which opens multiple copies on windows 98. I'm trying to check the process list to determine if it is already running. So far all the example win32 routines I've found, through google, only work on newer xp and nt versions of windows. This is the current attempt to get the process list on windows 98: def GetProcessNameList(): from win32com.client import GetObject WMI = GetObject('winmgmts:')
4
9180
by: Rajesh Kumar Mallah | last post by:
Hi, We need to implement following logic efficiently. SELECT * from some_table where .... IF rows_matched = 1 THEN use the single row that matched.
6
1602
by: Martin Hampl | last post by:
Hi, I am using PostgreSQL 7.4, but I did have the same problem with the last version. I indexed the column word (defined as varchar(64)) using lower(word). If I use the following query, everything is fine, the index is used and the query is executed very quickly: select * from token where lower(word) = 'saxophone';
17
14364
by: Olivier Bellemare | last post by:
I've tried to make a function that returns the middle of a string. For example: strmid("this is a text",6,4); would return "is a". Here is my code: char *strmid(char *texte, int depart, int longueur) { char *resultat = " "; char *temporaire = " "; int nbr;
4
2027
by: jimdscudder | last post by:
I am using a file watcher to watch for files changing. My problem is: the string file info returned is all LOWER CASE. Below is the important part of the code? Any suggestions? using System;
11
1961
by: The Crow | last post by:
i have a arraylist. say it contains integer values. i want to be able to inform user, which indexes in the array contain same values. but there can be N different values, and M different indexes having the same value. actually i will do this with javascript array to inform user which input's have same value. but i think its not a matter.
15
8415
by: dennis.richardson | last post by:
Greetings all. Here's a problem that's been driving me nuts for the last 48 hours. I'm hoping that someone has come across this before. I have a C# Application that reads a UDP broadcast (asynchronously). Then it repackages these UDP packets and sends them to a subscriber via TCP. Now, I can read the UDP stream all day long without the application
185
7140
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will return the file name given a FILE *. Questions: What would be the best name for this function?
0
10501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10250
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5603
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.