Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stl/inc/array
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public:
}

_CONSTEXPR20 void swap(array& _Other) noexcept(_Is_nothrow_swappable<_Ty>::value) {
_Swap_ranges_unchecked(_Elems, _Elems + _Size, _Other._Elems);
_STD _Swap_ranges_unchecked(_Elems, _Elems + _Size, _Other._Elems);
}

_NODISCARD _CONSTEXPR17 iterator begin() noexcept {
Expand Down Expand Up @@ -834,7 +834,7 @@ _NODISCARD constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty (&_Array)[_Size
"to_array does not accept multidimensional arrays.");
static_assert(is_constructible_v<_Ty, _Ty&>, "N4950 [array.creation]/1: "
"to_array requires copy constructible elements.");
return _To_array_lvalue_impl(_Array, make_index_sequence<_Size>{});
return _STD _To_array_lvalue_impl(_Array, make_index_sequence<_Size>{});
}

_EXPORT_STD template <class _Ty, size_t _Size>
Expand All @@ -843,7 +843,7 @@ _NODISCARD constexpr array<remove_cv_t<_Ty>, _Size> to_array(_Ty (&&_Array)[_Siz
"to_array does not accept multidimensional arrays.");
static_assert(is_move_constructible_v<_Ty>, "N4950 [array.creation]/4: "
"to_array requires move constructible elements.");
return _To_array_rvalue_impl(_STD move(_Array), make_index_sequence<_Size>{});
return _STD _To_array_rvalue_impl(_STD move(_Array), make_index_sequence<_Size>{});
}
#endif // _HAS_CXX20

Expand Down
15 changes: 15 additions & 0 deletions tests/std/tests/P0325R4_to_array/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ void assert_not_constexpr() {
assert_equal(to_array({"cats"s, "go"s, "meow"s}), array<string, 3>{"cats", "go", "meow"});
}

#ifndef _M_CEE // TRANSITION, VSO-1659496
struct incomplete;

template <class T>
struct holder {
T t;
};

void test_adl_proof() { // COMPILE-ONLY
holder<incomplete>* a[1]{};
(void) std::to_array(a); // intentionally qualified to avoid ADL
(void) std::to_array(std::move(a)); // intentionally qualified to avoid ADL
}
#endif // _M_CEE

int main() {
assert(assert_constexpr());
static_assert(assert_constexpr());
Expand Down