🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Shankar Unni Thu, 09 Nov 1995 05:59
num_get<>::do_get() and field separators
#2474
Author: 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. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads