Question about basic_string::find

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hello! I'm looking at the 2003 standard in section 21.3.6.1 on 
basic_string::find. The first method discussed there allows one to 
search a string for another string. It says that it returns a value, 
xpos, such that 

    at(xpos + I) == str.at(I) for all elements I of the string 
controlled by str.

In this situation 'str' is the string given as an argument to find. 
However, in the "Notes" section the standard says "Uses traits::eq()". 
The use of traits::eq() makes sense. Otherwise, for example, building 
case insensitive strings by providing alternate traits wouldn't work as 
expected. However, shouldn't the earlier condition really be

    traits::eq( at(xpos + I), str.at(I) ) for all elements I of the 
string controlled by str.

There seems to be a contradition here. The method is supposed to use 
traits::eq() yet it returns a value based on applications of operator==. 
Is this a standard bug or am I misunderstanding something?

Peter

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
0
Reply Peter 8/23/2004 10:11:44 PM

See related articles to this posting

comp.lang.c++.moderated 10662 articles. 10 followers. Post

0 Replies
200 Views

Similar Articles

[PageSpeed] 52


Reply:

Similar Artilces:

Finding centroids finds too many points (and a question about order)
Hi All I have written some code whereby I take an image and I am looking for a specific event. The event is a spark. Happily, I can convert to grey and remove all values below pure white (255) and this generally leaves the spark only. I then convert to a binary image. The white blobs that represent the spark can be a bit horrible looking so I use a structured element and image dilation to bulk out and smooth out the blobs. i.e. strel('octagon',3) I can end up sometimes with one big blob (where 1 or more blobs have merged together) or I can end up with a series of blobs (whe...

Questions, questions & more questions
Hi all, As I've got rather a lot of questions to post I thought I'd better merge a few into one post. Appreciate these have probably been asked stacks of times but research on the net has not turned up the answers. What's the quickest solution for transferring files from a PC to an Falcon/TT? I'm going to look into networking my Atari kit but that's a little way off at the moment. Is the Backwards ST emulator program still available? Would love to play some of my old favourites such as Megalomania. I know that I could use a PC emulator but somehow that...

Questions, Questions...
Hi! I took the routine from Gastronor.mdb: In the frmOrderDetails -> ITemID_AfterUpdate: Dim strFilter as String strFilter = "ItemID = " & Me!ItemID but it didn't work on win 2000 with access 2000. However, after playing around for a while, I found: Me!UnitPrice = ItemID.Column(2) to work just fine, even after updating prices in the tblItems. Anybody knows why? The routine in win 98/win nt in the footer of frmOrderDetails: =Sum((Price*Amount*(1-[Discount])/100)*100)) didn't either work. After testing and trying I finally discovered that =Sum(Price*Amount*Discount)...

FIND() question
Hi i would like a bit of help using the find function i have 2 matrixes a = [ 2,4,6; 8,10,12; 14,16,18] b = [ 2,4,8; 4,7,10; 14,23,56] i want to use the find function to find out how many variables in the first column of each of the two matrixes so that for this example the answer would 2 ( 2 and 14 in first col for oth matrixes) how do i go about thsi? Thanks ive tried find(a(:,1) = b(:,1)) but this does not work :( "Fraser Dickson" <fraser.dickson@gmail.com> wrote in message <hmo0ma$apf$1@fred.mathworks.com>...

Questions that question????
Hi everybody, I am thinking abt how much information can be provided to a quetion posted related to design with emerging hitech FPGA's.I started using this usenet just a few weeks ago,and I find it very interesting to notice people with great experience working in industries or with FPGA manufacuturers replying to the best they could.So I started thinking, how much of an information related to the desing should be given for a question. The less information i give, i likely to get no repliess, and the more i give , i might loose my valuable design , what would be a tradeoff here? So, how ...

Questions over questions
Hello people, I have a problem with my ISP! He kills my php script, if they were executed over 30 seconds. Can I use some trick to fake a little bit? That I can execute the script longer!? Greeting! Sven Dzepina wrote: > Hello people, > > I have a problem with my ISP! He kills my php script, if they were executed > over 30 seconds. > Can I use some trick to fake a little bit? That I can execute the script > longer!? > > Greeting! > > If your ISP doesn't run your script in safe mode, which it most likely does, then you can set_time_limit(0); for unli...

Question about a question
Steve Pampling: Steve, do you take a.a.bugs? I need a smidgin of advice about a particular Win PC question, it needs putting to a Sys/IT maintenance/admin type person rather than any old idiot like me. If you don't sub to ..bugs can I please email you privately, as I did around Christmas time (same old computer)? Cheers Dave S -- In article <4e2368520fdfs@ukgateway.net>, Dave Symes <dfs@ukgateway.net> wrote: > Steve Pampling: > Steve, do you take a.a.bugs? Nope. I vaguely recall it being on a list some time ago (years) but I shortened things to the core csa and ...

Find All Question
At one time I knew of a scrpt that would search the entire data base for a key word in all the fields that were designated in the script... I think they included the && but for the life of me I cannot remember how to set it up. Example Presidents telephone number, VP Tel No., Asst. Tel. No. So if I would do a FIND and enter the telephone number it would search through all the telephone fields and provide the answer I was seeking. Thanks in ADVANCE.... Jace jas wrote: > At one time I knew of a scrpt that would search the entire data base for a > key word in all the fie...

Find Question
Hi All, I am trying to write a find command that will list all jpg or gif files under my home direcotry. I tried the following: find . -type f -name '*.{gif,jpg}' -print but did not return anything. The second try was: find . -type f -name '*.gif' -o -name '*.jpg' -print but this would only return the jpg files, not gif ones. What am I doing wrong? Regards, George On 2008-04-01, George <me@me.com> wrote: > > > Hi All, > > I am trying to write a find command that will list all jpg or gif files > under my home direcotry. I tried the follo...

question about find
I have the following script to delete some log files: 1 #! /usr/bin/ksh 2 #delete collection files 3 LogCollDir=/data/ 4 BackUpDays=3 5 FilePref=collection.log 6 nice -19 find ${LogCollDir} -name "${FilePref}.??????????" -mtime +${BackUpDays} -exec rm -f {} \; & 7 8 #Remove old activity log files. 9 #Only the most recent one is left 10 ActLog=/data/act_*.log 11 nice -19 ls -t ${ActLog} | nawk '{ if ( NR != 1 ) { system("rm -f " $0) } }'& The script runs every night and sometimes I get an error like: find: stat() error /data/act_...

find() question
I want to overload the std::find so i don't have to write array.begin(), array.end() everytime. so the following is my solution: template <template <typename EleT> class ContainerT, typename ElementT> typename ContainerT<ElementT>::iterator // return type find( const ContainerT<ElementT>& container, const ElementT& element) { return std::find(container.begin(), container.end(), element); } But I got const type conversion error from the overloaded find above. ...

find question again
Hello, I have a list of .php files in one directory called news/. the naming convention for these files is like this 103_ds_13998.php 15_ds_24930.php 26_ds_53237.php 36_ds_24913.php 45_ds_39596.php 61_ds_37034.php 70_ds_23038.php 103_ds_14199.php 15_ds_24932.php 26_ds_53348.php 36_ds_24916.php 45_ds_39608.php 61_ds_37595.php 70_ds_25378.php 103_ds_14457.php 15_ds_24996.php 26_ds_53451.php 36_ds_24963.php 45_ds_39612.php 61_ds_37617.php 70_ds_28041.php 103_ds_14532.php 15_ds_25045.php 26_ds_53608.php 36_ds_25033.php 45_ds_39689.php 61_ds_37772.php 70_ds_30527.php 103_ds...

find.find
import fnmatch, os def find(pattern, startdir=os.curdir): matches = [] os.path.walk(startdir, findvisitor, (matches, pattern)) matches.sort() return matches def findvisitor((matches, pattern), thisdir, nameshere): # for name in nameshere: if fnmatch.fnmatch(name, pattern): fullpath = os.path.join(thisdir, name) matches.append(fullpath) can someone explain why (matches, pattern) is doing in this two funct? thanks In <eo15uq$hna$1@ss408.t-com.hr>, Gigs_ wrote: > import fnmatch, os > > def find(pattern, startdir=os...

Find::Find
I'm writing a script to process a directory tree of images.  In each directory, I need to process each image and generate an HTML file listing all of the images and links to the subdirectories. Just about every source I can find on the 'net for processing subdirectories points you at Find::Find.  However, I'm trying to do something like this: enter directory open INDEX, ".\index.html" print INDEX HTMLheader foreach file{         if(file is an image){  ...

find question
G'day, What is the trick when using find in order to be able to extract a portion of data from a matrix. For example, I have a matrix (n,10). I can use find to identify specific data of interest e.g. [wI]=find(combined_data(:,2)==1 | combined_data(:,2)==2 | combined_data(:,2)==3); ws = combined_data(:,7); wd = combined_data(:,8); dur = combined_data(:,9); ws=ws(wI); wd=wd(wI); dur=dur(wI); WD=[ws wd dur]; However, in this example I am having to select specific columns of data (2nd line), apply the index to each of those columns (3rd line) and then rebuild the new matrix. Is there a ...

More findings and questions
I've looked into my problem some more and I have a number of questions. First, to recap, I have a UDP app in which I am evidently calling sendto() too quickly, resulting in packets being overwritten and lost. I put together a test app in which I call sendto() in a loop. I verified that this duplicates the problem. Using this app, I can see that if I call sendto() twice, one right behind the other, the first gets overwritten. This means (I think) that sendto() does not queue up more than one packet at a time. Is there a way to configure WinSock to queue up more than one pack...

[BASH]
Hi! I need this pair of scipt in bash, are you able to help me? 1) Find all the files with a specific permission (for example 0644) into a directory tree. 2) Find all the files that belong to the user who execute the bash-scipt. (note that the script is executed from a program wrote in C, a kind of shell..) Excuse me for my bad english. Tank you very much. wigga On Wed, 09 Jun 2004 19:42:24 GMT, wigga <wigga@email.it> wrote: > > > Hi! > I need this pair of scipt in bash, are you able to help me? > 1) Find all the files with a specific permission (for example 0644) i...

simple question (couldn't find in FAQ couldn't find with google search)
hey, this is a simple question which I was surprised that I couldn't find after reading the mutt manual and a google search... how exactly do you get a split screen, so that the top shows the message you are on, and the bottom gives you a preview? I would think the obvious choice for a config option would be set split_screen=<size> or somesuch, but apparently not. Could someone post the correct usage for the sake of me and other googling people to come? thanks, jon On 29 Dec 2003 21:27:19 -0800, jonathan wrote: > how exactly do you get a split screen, so ...

Find.find does not find orphaned links?
Find.find does not seem to find orphaned links: Downloads>ln -s /nonexistent Downloads>ls -l total 0 lrwxrwxrwx 1 wybo users 12 Nov 15 14:15 nonexistent -> /nonexistent Downloads>irb irb(main):001:0> require 'find' => true irb(main):002:0> Find.find('.') do |f| puts f end Hi, In message "Re: Find.find does not find orphaned links?" on Tue, 15 Nov 2005 22:19:59 +0900, Wybo Dekker <wybo@servalys.nl> writes: |Find.find does not seem to find orphaned links: It's a bug. Thank you. matz. ...

19990823: General announcements. Goedel's question: if a theorem has a proof of length at most n, can we find it in time O(n^2)? Another question on what can be computed in limited time and sp
19990823: General announcements. Goedel's question: if a theorem has a proof of length at most n, can we find it in time O(n^2)? Another question on what can be computed in limited time and space. Overview of related topics from courses on algorithms, theory of computation, formal logic. Definition of composite. Definition of prime. Examples. The primality problem. Some representations of integers: decimal; binary; unary; factored. The importance of specifying the input representation. Simple algorithm for the primality problem. Time for dividing n-digit numbers. Overall time for simple al...

find Question #4
I need to find files that have been modified in the last 7 days, but I want to exclude any that have been modified today. I been fartin' and foolin' with -mtime and -newer to no avail. Ideas? Thanks On Thu, 30 Oct 2003 13:45:51 GMT, secheese <secheese@hotmail.com> wrote: >I need to find files that have been modified in the last 7 days, but I >want to exclude any that have been modified today. I been fartin' and >foolin' with -mtime and -newer to no avail. Ideas? > >Thanks Hmmm... I wonder if I can answer this myself. I'll try: -mtime 1 -mtim...

find command questions
hello , I have a file that contains file names that I need to find , I was wondering if the find command has the abilty to read a file as the pattern to look for ....... Right now this is my workaround : QT_FILE=$1 for x in ` cat customer/QUOTES/$QT_FILE | nawk '{ print $1 }' ` do find ./src ./customer -name $x done What I was hoping to have was something like : find . -name "`cat file_that_contains_files_to_look_for`" Thanks ..... In article <YZEjb.92922$PD3.4887434@nnrp1.uunet.ca>, Mariusz Malogrosz <mariuszm@tecsys.com> wrote: >hello , > >...

find question 156767
I have 2 databases, ORDERS and RECEIVED. Both have the catalog number of the items ordered. cat# I want to find out which items have not arrived yet. In ORDERS I make a script that loops through all the records (line items) , picks up the cat# and then goes over to RECEIVED and loops through all the records looking for a match for cat#. For the inner loop I suppose I could use FIND ...BUT what is the result code name? Is there a boolean script variable like FOUND? Or better still, if a relationship is established on that field cat# , is there a built-in function that will say whethe...

Question: Help with Find
Hi, all. I'm using AIX 5.2.0.0. I have a directory that has a bunch of subdirectories; I want to scour these subdirectories for files, and tar them up. For the sake of illustration, let's say the directories are COMMON1, COMMON2, COMMON3, GLOB, SLOB and BLOB. I have 2 prereqs: 1) certain file types (*.Z,*.dmp,*.tar) should be omitted. This bit I have worked out. 2) The result should be that I have 2 tars, one of which contains the valid files that appeared under the COMMON* directories, and the other of which contains the contents of all directories BUT COMMON*. For the first one...