-
-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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.
- Loading branch information
Showing
2 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters