Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofCD1 status.

182. Ambiguous references to size_t

Section: 16[library]Status:CD1Submitter: Al StevensOpened: 1999-08-15Last modified: 2016-01-28

Priority:Not Prioritized

View otheractive issues in [library].

View all otherissues in [library].

View all issues withCD1 status.

Discussion:

Many references to size_t throughout the documentomit the std:: namespace qualification.

Forexample, 16.4.5.6[replacement.functions] paragraph 2:

 operator new(size_t) operator new(size_t, const std::nothrow_t&) operator new[](size_t) operator new[](size_t, const std::nothrow_t&)

Proposed resolution:

In 16.4.5.6[replacement.functions] paragraph 2: replace:

- operator new(size_t)
- operator new(size_t, const std::nothrow_t&)
- operator new[](size_t)
- operator new[](size_t, const std::nothrow_t&)

by:

- operator new(std::size_t)- operator new(std::size_t, const std::nothrow_t&)- operator new[](std::size_t)- operator new[](std::size_t, const std::nothrow_t&)

In [lib.allocator.requirements] 20.1.5, paragraph 4: replace:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, size_t, and ptrdiff_t, respectively.

 by:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, std::size_t, and std::ptrdiff_t, respectively.

In [lib.allocator.members] 20.4.1.1, paragraphs 3 and 6: replace:

3 Notes: Uses ::operator new(size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

by:

3 Notes: Uses ::operator new(std::size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(std::size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

In [lib.char.traits.require] 21.1.1, paragraph 1: replace:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

by:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type std::size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

In [lib.char.traits.require] 21.1.1, table 37: replace the return type ofX::length(p): "size_t" by "std::size_t".

In [lib.std.iterator.tags] 24.3.3, paragraph 2: replace:
    typedef ptrdiff_t difference_type;
by:
    typedef std::ptrdiff_t difference_type;

In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the declaration of template <class charT> class ctype.

In [lib.iterator.traits] 24.3.1, paragraph 2 put namespace std { ...} around the declaration of:

    template<class Iterator> struct iterator_traits
    template<class T> struct iterator_traits<T*>
    template<class T> struct iterator_traits<const T*>

Rationale:

The LWG believes correcting names likesize_t andptrdiff_t tostd::size_t andstd::ptrdiff_tto be essentially editorial. There there can't be another size_t orptrdiff_t meant anyway because, according to 16.4.5.3.5[extern.types],

For each type T from the Standard C library, the types ::T and std::Tare reserved to the implementation and, when defined, ::T shall beidentical to std::T.

The issue is treated as a Defect Report to make explicit the ProjectEditor's authority to make this change.

[Post-Tokyo: Nico Josuttis provided the above wording at therequest of the LWG.]

[Toronto: This is tangentially related to issue229(i), but only tangentially: the intent of this issue is toaddress use of the namesize_t in contexts outside ofnamespace std, such as in the description of::operator new.The proposed changes should be reviewed to make sure they arecorrect.]

[pre-Copenhagen: Nico has reviewed the changes and believesthem to be correct.]


[8]ページ先頭

©2009-2026 Movatter.jp