Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. COWhen you say _"The purpose of the value_type of an iterator is to define the type that is returned when that iterator is dereferenced"_, can you please specify the reference for that? A wording in the standard, perhaps? In section 24.3.1 of the standard I see no details about what `value_type` is for, only that output iterators may set it to void. In the TCPL3e, section 19.2.2, Stroustrup says only that "`value_type` is the type of element".
      singulars
    2. COFrom section 24.1 of the standard, "All iterators i support the expression *i, resulting in a value of some class, enumeration, or built-in type T, called the value type of the iterator." From section 24.3.1, "[...] it is required that if Iterator is the type of an iterator, [...] iterator_traits<Iterator>::value_type be defined as the iterator's [...] value type [...] ." Also from section 24.3.1, "In the case of an output iterator, [...] iterator_traits<Iterator>::value_type [... is ...] defined as void."
      singulars
    3. COOk, I know that output iterators have `value_type` set to `void`. With `*i` being the `value_type` of `i`, and the programmer not allowed to dereference `i`, there's still a leap into allowing `*i` to be `void`. It needn't be `void`. There are other, valid uses for `value_type`. I'm not debating this, I just don't understand the leap from "you can't dereference an output iterator" to "let's define the `value_type` of an output iterator to `void`".
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload