Skip to content

Commit

Permalink
P0009R18 <mdspan> (#3972)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Stephanson <[email protected]>
Co-authored-by: Jakub Mazurkiewicz <[email protected]>
Co-authored-by: Casey Carter <[email protected]>
Co-authored-by: A. Jiang <[email protected]>
Co-authored-by: Alex Guteniev <[email protected]>
  • Loading branch information
6 people authored Sep 14, 2023
1 parent cca303b commit 23bc2a0
Show file tree
Hide file tree
Showing 36 changed files with 6,306 additions and 4 deletions.
1 change: 1 addition & 0 deletions stl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ set(HEADERS
${CMAKE_CURRENT_LIST_DIR}/inc/list
${CMAKE_CURRENT_LIST_DIR}/inc/locale
${CMAKE_CURRENT_LIST_DIR}/inc/map
${CMAKE_CURRENT_LIST_DIR}/inc/mdspan
${CMAKE_CURRENT_LIST_DIR}/inc/memory
${CMAKE_CURRENT_LIST_DIR}/inc/memory_resource
${CMAKE_CURRENT_LIST_DIR}/inc/mutex
Expand Down
1 change: 1 addition & 0 deletions stl/inc/__msvc_all_public_headers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
#include <list>
#include <locale>
#include <map>
#include <mdspan>
#include <memory>
#include <memory_resource>
#include <new>
Expand Down
1 change: 1 addition & 0 deletions stl/inc/header-units.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"list",
"locale",
"map",
"mdspan",
"memory",
"memory_resource",
"mutex",
Expand Down
1,460 changes: 1,460 additions & 0 deletions stl/inc/mdspan

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
// Other C++20 deprecation warnings

// _HAS_CXX23 directly controls:
// P0009R18 <mdspan>
// P0288R9 move_only_function
// P0323R12 <expected>
// P0401R6 Providing Size Feedback In The Allocator Interface
Expand Down Expand Up @@ -374,9 +375,13 @@
// P2539R4 Synchronizing print() With The Underlying Stream
// P2540R1 Empty Product For Certain Views
// P2549R1 unexpected<E>::error()
// P2599R2 mdspan: index_type, size_type
// P2604R0 mdspan: data_handle_type, data_handle(), exhaustive
// P2613R1 mdspan: empty()
// P2652R2 Disallowing User Specialization Of allocator_traits
// P2693R1 Formatting thread::id And stacktrace
// P2713R1 Escaping Improvements In std::format
// P2763R1 Fixing layout_stride's Default Constructor For Fully Static Extents

// _HAS_CXX23 and _SILENCE_ALL_CXX23_DEPRECATION_WARNINGS control:
// P1413R3 Deprecate aligned_storage And aligned_union
Expand Down Expand Up @@ -1800,10 +1805,15 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define __cpp_lib_formatters 202302L
#endif // defined(__cpp_lib_concepts)

#define __cpp_lib_forward_like 202207L
#define __cpp_lib_invoke_r 202106L
#define __cpp_lib_ios_noreplace 202207L
#define __cpp_lib_is_scoped_enum 202011L
#define __cpp_lib_forward_like 202207L
#define __cpp_lib_invoke_r 202106L
#define __cpp_lib_ios_noreplace 202207L
#define __cpp_lib_is_scoped_enum 202011L

#ifdef __cpp_lib_concepts
#define __cpp_lib_mdspan 202207L
#endif // defined(__cpp_lib_concepts)

#define __cpp_lib_move_only_function 202110L

#ifdef __cpp_lib_concepts
Expand Down
3 changes: 3 additions & 0 deletions stl/modules/std.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ export module std;
#include <list>
#include <locale>
#include <map>
#if _HAS_CXX23
#include <mdspan>
#endif // _HAS_CXX23
#include <memory>
#include <memory_resource>
#include <mutex>
Expand Down
16 changes: 16 additions & 0 deletions tests/std/include/test_header_units_and_modules.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,19 @@ void test_map() {
assert(m[30] == 33);
}

#if TEST_STANDARD >= 23
void test_mdspan() {
using namespace std;
puts("Testing <mdspan>.");
int arr[] = {10, 0, 0, 0, 20, 0, 0, 0, 30};
layout_right::mapping<extents<int, 3, 3>> mp;
assert(arr[mp(0, 0)] == 10);
assert(arr[mp(1, 1)] == 20);
assert(arr[mp(2, 2)] == 30);
// TRANSITION, test std::mdspan too (DevCom-10359857)
}
#endif // TEST_STANDARD >= 23

void test_memory() {
using namespace std;
puts("Testing <memory>.");
Expand Down Expand Up @@ -1111,6 +1124,9 @@ void all_cpp_header_tests() {
test_list();
test_locale();
test_map();
#if TEST_STANDARD >= 23
test_mdspan();
#endif // TEST_STANDARD >= 23
test_memory();
test_memory_resource();
test_mutex();
Expand Down
Loading

0 comments on commit 23bc2a0

Please sign in to comment.