🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2474

num_get<>::do_get() and field separators

#2474
From: Shankar Unni
Date: Thu, 09 Nov 1995 05:59
38 lines
2209 bytes
I'm trying to implement bool input routines, and couldn't quite get a hang of
whether alphabetic bool input ("true", "false") must be followed by a
non-alphanumeric character or not. The latest draft says "reads characters
until it determines whether [ ... true or false sequence is present ... ]"..

I.e., given the following input:

  truefalse

What is a call to

  bool b;
  num_get<char>::get(...., b, ..);

supposed to do?  Is it supposed to consume "true", and return b == true with
the iterator pointing to 'f', or is it supposed to consume the entire token
and return a failure state without modifying b?

What about non-alphabetic bool input (i.e. reading 1 or 0)? Is that supposed
to be followed by a non-numeric character (looks like it)?

The quote from the Sep 95 draft is:

    3 If  flags.flag()  &  ios_base::boolalpha  is  false,  num_get<>::get()
      (_lib.category.numeric_) tries to read  an  integer  value,  which  if
      found  must be 0 or 1; if the boolalpha flag is true, it reads charac­
      ters until it determines whether the numpunct<>::truename() or  false­
      name() sequence23) is present.  In either case if an  exact  match  is
      not found calls setstate(failbit).

--
Shankar Unni				E-Mail:	shankar@sgi.com
Silicon Graphics Inc.			Phone:	+1-415-933-2072
URL:	http://reality.sgi.com/employees/shankar
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <9511081404.ZM2727@boris.engr.sgi.com>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 09 Nov 95 05:59:03 GMT
Approved: fjh@cs.mu.oz.au
Organization: -
Newsgroups: comp.std.c++
Return-Path: <daemon@migs.UCAR.EDU>
From: "Shankar Unni" <shankar@boris.engr.sgi.com>
Message-ID: <9511081404.ZM2727@boris.engr.sgi.com>
X-Original-Date: Wed, 8 Nov 1995 14:04:31 -0800
X-Mailer: Z-Mail (3.2.2 10apr95 MediaMail)
Subject: num_get<>::do_get() and field separators
Cc: shankar@boris.engr.sgi.com
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMKGZkuEDnX0m9pzZAQEdFAGAoT2y7xRViLlUnKKmBFHM4gFBLxI8BxaD
 Li2bcJrEb5Gq19hPcZQrjMjJGiCCyF3C
 =lXKw