Skip to content

Commit

Permalink
Implement inplace_vector
Browse files Browse the repository at this point in the history
  • Loading branch information
vasama committed Jul 20, 2024
1 parent ecbc1ef commit 00c2aba
Show file tree
Hide file tree
Showing 8 changed files with 1,604 additions and 11 deletions.
1,109 changes: 1,109 additions & 0 deletions stl/inc/inplace_vector

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions stl/inc/optional
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ protected:
_THROW(bad_optional_access{});
}

struct _Nontrivial_dummy_type {
constexpr _Nontrivial_dummy_type() noexcept {
// This default constructor is user-provided to avoid zero-initialization when objects are value-initialized.
}
};
_STL_INTERNAL_STATIC_ASSERT(!is_trivially_default_constructible_v<_Nontrivial_dummy_type>);

#if _HAS_CXX23
struct _Construct_from_invoke_result_tag {
explicit _Construct_from_invoke_result_tag() = default;
Expand Down
4 changes: 0 additions & 4 deletions stl/inc/vector
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ struct _Vec_iter_types {
using const_pointer = _Const_pointer;
};

struct _Value_init_tag { // tag to request value-initialization
explicit _Value_init_tag() = default;
};

template <class _Val_types>
class _Vector_val : public _Container_base {
public:
Expand Down
13 changes: 13 additions & 0 deletions stl/inc/xutility
Original file line number Diff line number Diff line change
Expand Up @@ -7422,6 +7422,19 @@ _NODISCARD constexpr bool _Mul_overflow(const _Int _Left, const _Int _Right, _In
}
#endif // _HAS_CXX17

#if _HAS_CXX17
struct _Nontrivial_dummy_type {
constexpr _Nontrivial_dummy_type() noexcept {
// This default constructor is user-provided to avoid zero-initialization when objects are value-initialized.
}
};
_STL_INTERNAL_STATIC_ASSERT(!is_trivially_default_constructible_v<_Nontrivial_dummy_type>);
#endif // _HAS_CXX17

struct _Value_init_tag { // tag to request value-initialization
explicit _Value_init_tag() = default;
};

_STD_END

// TRANSITION, non-_Ugly attribute tokens
Expand Down
4 changes: 4 additions & 0 deletions stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,10 @@ _EMIT_STL_ERROR(STL1004, "C++98 unexpected() is incompatible with C++23 unexpect
#define __cpp_lib_unreachable 202202L
#endif // _HAS_CXX23

#if _HAS_CXX26
#define __cpp_lib_inplace_vector 202406L
#endif // _HAS_CXX26

// macros with language mode sensitivity
#if _HAS_CXX20
#define __cpp_lib_array_constexpr 201811L // P1032R1 Miscellaneous constexpr
Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ tests\P0784R7_library_machinery
tests\P0784R7_library_support_for_more_constexpr_containers
tests\P0798R8_monadic_operations_for_std_optional
tests\P0811R3_midpoint_lerp
tests\P0843R14_inplace_vector
tests\P0881R7_stacktrace
tests\P0896R4_common_iterator
tests\P0896R4_common_iterator_death
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/P0843R14_inplace_vector/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_latest_matrix.lst
Loading

0 comments on commit 00c2aba

Please sign in to comment.