6 Commits

Author SHA1 Message Date
Steffen Zimmermann
927bb3cf5a
Make span std compliant (#317)
* add missing overloads for span::first + span::last

The C++20 standard defines additional overloads for first and last:

  template< std::size_t Count >
  constexpr std::span<element_type, Count> first() const;
  constexpr std::span<element_type, std::dynamic_extent> first( size_type Count ) const;

  template< std::size_t Count >
  constexpr std::span<element_type, Count> last() const;
  constexpr std::span<element_type, std::dynamic_extent> last( size_type Count ) const;

etl implements only the first (= template) variants so far. To be able to
compile valid C++20 code the missing overload should be added.

* remove explicit specifier for span conversion operator

The C++20 standard allows to assign a span of non-const elements to a span of
const elements. Example:

    std::span<const int> cintspan;
    std::span<int> intspan;
    cintspan = intspan;

This is enabled in the STL by using an explicit specifier with a constant
expression for one of the conversion constructors:

    template< class R >
    explicit(extent != std::dynamic_extent)
    constexpr span( R&& r );

The explicit specifier together with a constant expression is a C++20 feature
and therefore can't be used within etl. To be able to compile valid C++20
code which uses the conversion on assignment, the explicit specifier has to
be removed.

* remove explicit specifier for span conversion operator

The C++20 standard allows to assign an array of elements directly (without
explicitly using a conversion constructor). Example:

    const int data = { 1, 2, 3 };
    std::span<const int> cintspan;
    cintspan = data;

To be able to compile valid C++20 code which uses the conversion on assignment,
the explicit specifier of the array-conversion constructor has to be removed.
2020-12-09 14:33:34 +00:00
John Wellbelove
9eaa3e1178 Fix make_string for zero length literals
Remove redundant test support code
2020-11-18 18:29:20 +00:00
John Wellbelove
18d8236f91 Conditionally disable template deduction guide tests 2020-09-29 11:23:10 +01:00
John Wellbelove
509089c0e2 Added template deduction guides 2020-09-28 13:14:12 +01:00
Andreas W
4f31c6e40e
Fix span dynamic extent (#235)
* Enable span tests

* Handle dynamic extent in span::subspan

Fixes #234

Correct handling when count equals dynamic_extent,
which would previously cause the end pointer to be set to the
wrong location.
2020-06-18 13:12:57 +01:00
John Wellbelove
7b61eec2a6 Added etl::span 2020-04-01 15:11:07 +01:00