A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue4293 below:

subspan/first/last chooses wrong constructor when T is const-qualified bool


template<size_t Count> constexpr span<element_type, Count> first() const;

-1- Mandates: Count <= Extent is true.

-2- Hardened preconditions: Count <= size() is true.

-3- Effects: Equivalent to: return R ( {data(), Count } ); where R is the return type.


template<size_t Count> constexpr span<element_type, Count> last() const;

-4- Mandates: Count <= Extent is true.

-5- Hardened preconditions: Count <= size() is true.

-6- Effects: Equivalent to: return R ( {data() + (size() - Count), Count } ); where R is the return type.


template<size_t Offset, size_t Count = dynamic_extent>
  constexpr span<element_type, see below> subspan() const;

-7- Mandates:

Offset <= Extent && (Count == dynamic_extent || Count <= Extent - Offset)
is true.

-8- Hardened preconditions:

Offset <= size() && (Count == dynamic_extent || Count <= size() - Offset)
is true.

-9- Effects: Equivalent to:

return span<ElementType, see below>(
    data() + Offset, Count != dynamic_extent ? Count : size() - Offset);

-10- Remarks: The second template argument of the returned span type is:

Count != dynamic_extent ? Count
                        : (Extent != dynamic_extent ? Extent - Offset
                                                    : dynamic_extent)

constexpr span<element_type, dynamic_extent> first(size_type count) const;

-11- Hardened preconditions: count <= size() is true.

-12- Effects: Equivalent to: return R( {data(), count } ); where R is the return type.


constexpr span<element_type, dynamic_extent> last(size_type count) const;

-13- Hardened preconditions: count <= size() is true.

-14- Effects: Equivalent to: return R( {data() + (size() - count), count } ); where R is the return type.


constexpr span<element_type, dynamic_extent> subspan(
  size_type offset, size_type count = dynamic_extent) const;

-15- Hardened preconditions:

offset <= size() && (count == dynamic_extent || count <= size() - offset
is true.

-16- Effects: Equivalent to:

return R({data() + offset, count == dynamic_extent ? size() - offset :  count});
where R is the return type.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4