Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<xmemory> Add constexpr to allocator traits #1369

Merged
merged 55 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
0b94bc2
Add support for more constexpr containers
MichaelRizkalla Oct 13, 2020
ac7ef50
Conform to clang-format.
MichaelRizkalla Oct 14, 2020
4255a9e
Apply suggestions from code review
MichaelRizkalla Oct 14, 2020
7276cec
_Default_allocator_traits members, _Allocate and _Deallocate made con…
MichaelRizkalla Oct 14, 2020
31425fd
Conform to clang-format
MichaelRizkalla Oct 14, 2020
822be04
correctly place __cpp_lib_constexpr_dynamic_alloc and add feature test
MichaelRizkalla Oct 14, 2020
45d1234
Enforce clang-format
MichaelRizkalla Oct 14, 2020
8b15800
Update tests/std/tests/VSO_0157762_feature_test_macros/test.cpp
MichaelRizkalla Oct 15, 2020
a16d3cc
Add allocator_traits and allocator tests
MichaelRizkalla Oct 16, 2020
6cfaf58
Enforce clang-format
MichaelRizkalla Oct 16, 2020
3ca91cf
Modify allocator_traits:: construct and destroy
MichaelRizkalla Oct 16, 2020
d90e6f9
Modify tests to fix test allocator bugs
MichaelRizkalla Oct 16, 2020
3ed0bc6
Add missing semicolon
StephanTLavavej Nov 5, 2020
ccee004
Apply suggestions from code review
MichaelRizkalla Nov 12, 2020
8471dad
Update tests as per the review.
MichaelRizkalla Nov 13, 2020
ad304c8
Fix tests and adopt for MSVC changes
miscco Nov 23, 2020
a4614aa
Changes as requested by the last reviews
MichaelRizkalla Nov 25, 2020
740fb65
Apply suggestions from code review
MichaelRizkalla Nov 26, 2020
92c7f94
Clang-format
MichaelRizkalla Dec 10, 2020
1d2c8db
Fix compilation errors, get tests passing, clang 11 format
mnatsuhara Dec 10, 2020
1b11372
Update feature test macro test to check when clang or EDG
mnatsuhara Dec 10, 2020
5d16c01
Remove XPASSing tests from XFAIL list
cbezault Dec 11, 2020
1d2715f
Removed something incorrect from the XFAIL list
cbezault Dec 11, 2020
0badddf
Test now passes for both MSVC and Clang
cbezault Dec 11, 2020
9fceac7
One more unexpectedly passing test
cbezault Dec 11, 2020
cef7d11
Apply some code review suggestions
MichaelRizkalla Dec 12, 2020
5b5d0a7
Fix format
MichaelRizkalla Dec 12, 2020
d076d30
Constain ranges::destroy and ranges::destroy_n tests
MichaelRizkalla Dec 12, 2020
a284ffb
Fix decrementing a const variable
MichaelRizkalla Dec 12, 2020
4f83b63
Correct constraints for test
MichaelRizkalla Dec 12, 2020
8200599
Bug fix
MichaelRizkalla Dec 12, 2020
0d35c3f
One more bug fix
MichaelRizkalla Dec 12, 2020
9feaf8d
Use construct_at and destroy_at in tests and adjust accordingly
MichaelRizkalla Dec 12, 2020
6207dbc
Add tracking comments for GH-1532
MichaelRizkalla Dec 15, 2020
8fb45c0
Apply suggestions from code review
MichaelRizkalla Dec 19, 2020
3280005
Apply code review suggestions
MichaelRizkalla Dec 19, 2020
7286a4b
Revert back _Default_allocator_traits::destroy
MichaelRizkalla Dec 19, 2020
8f38fc3
Update tests to avoid object lifetime errors
MichaelRizkalla Dec 19, 2020
bc489ee
More test fixes
MichaelRizkalla Dec 19, 2020
686b519
Change _Default_allocator_traits::destroy
MichaelRizkalla Dec 30, 2020
580db38
Fix a typo
MichaelRizkalla Dec 30, 2020
0f9faf6
Add missing test cases
MichaelRizkalla Dec 30, 2020
ed0a233
Update transition comment to be unified
MichaelRizkalla Dec 30, 2020
19f0558
Add more test coverage and missing includes
MichaelRizkalla Dec 30, 2020
c82d160
clang-format
MichaelRizkalla Dec 30, 2020
cf86b05
Update tests
MichaelRizkalla Dec 30, 2020
8446779
Revert last 3 commits and add missing include file.
MichaelRizkalla Dec 30, 2020
7457abb
Change macro contraint of _Default_allocator_traits members
MichaelRizkalla Jan 5, 2021
ad25f39
Changes to achieve consistency
MichaelRizkalla Jan 6, 2021
08bf68f
Merge branch 'master' into MichaelRizkalla/master
mnatsuhara Jan 6, 2021
0705f3f
Drop std qualification.
StephanTLavavej Jan 7, 2021
d86dbd8
Code review feedback.
StephanTLavavej Jan 7, 2021
a2bd52f
Avoid verbose auto.
StephanTLavavej Jan 7, 2021
bf1c2ec
Adjust compiler guards.
StephanTLavavej Jan 7, 2021
4ccb165
Fix compiler guards, add comments.
StephanTLavavej Jan 7, 2021
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
47 changes: 8 additions & 39 deletions stl/inc/memory
Original file line number Diff line number Diff line change
Expand Up @@ -496,22 +496,7 @@ namespace ranges {
};

MichaelRizkalla marked this conversation as resolved.
Show resolved Hide resolved
inline constexpr _Uninitialized_fill_n_fn uninitialized_fill_n{_Not_quite_object::_Construct_tag{}};
} // namespace ranges
#endif // __cpp_lib_concepts

// FUNCTION TEMPLATE construct_at
#if _HAS_CXX20
template <class _Ty, class... _Types>
_CONSTEXPR20_DYNALLOC auto construct_at(_Ty* const _Location, _Types&&... _Args) noexcept(
noexcept(::new (const_cast<void*>(static_cast<const volatile void*>(_Location)))
_Ty(_STD forward<_Types>(_Args)...))) // strengthened
-> decltype(
::new (const_cast<void*>(static_cast<const volatile void*>(_Location))) _Ty(_STD forward<_Types>(_Args)...)) {
return ::new (const_cast<void*>(static_cast<const volatile void*>(_Location))) _Ty(_STD forward<_Types>(_Args)...);
}

#ifdef __cpp_lib_concepts
namespace ranges {
// VARIABLE ranges::construct_at
class _Construct_at_fn : private _Not_quite_object {
public:
Expand All @@ -532,26 +517,7 @@ namespace ranges {
};

inline constexpr _Construct_at_fn construct_at{_Not_quite_object::_Construct_tag{}};
} // namespace ranges
#endif // __cpp_lib_concepts
#endif // _HAS_CXX20

#if _HAS_CXX17
// FUNCTION TEMPLATE destroy_at
template <class _Ty>
_CONSTEXPR20_DYNALLOC void destroy_at(_Ty* const _Location) noexcept /* strengthened */ {
#if _HAS_CXX20
if constexpr (is_array_v<_Ty>) {
_Destroy_range(_STD begin(*_Location), _STD end(*_Location));
} else
#endif // _HAS_CXX20
{
_Location->~_Ty();
}
}

#ifdef __cpp_lib_concepts
namespace ranges {
// VARIABLE ranges::destroy_at
// clang-format off
template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se>
Expand All @@ -577,9 +543,11 @@ namespace ranges {
} // namespace ranges
#endif // __cpp_lib_concepts

#if _HAS_CXX17
// FUNCTION TEMPLATE destroy
template <class _NoThrowFwdIt>
void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) { // destroy all elements in [_First, _Last)
_CONSTEXPR20_DYNALLOC void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) {
// destroy all elements in [_First, _Last)
_Adl_verify_range(_First, _Last);
_Destroy_range(_Get_unwrapped(_First), _Get_unwrapped(_Last));
}
Expand All @@ -606,7 +574,7 @@ namespace ranges {
// clang-format off
template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se>
requires destructible<iter_value_t<_It>>
/* _CONSTEXPR20_DYNALLOC */ _It operator()(_It _First, _Se _Last) const noexcept {
_CONSTEXPR20_DYNALLOC _It operator()(_It _First, _Se _Last) const noexcept {
// clang-format on
_Adl_verify_range(_First, _Last);
_Seek_wrapped(_First,
Expand All @@ -617,7 +585,7 @@ namespace ranges {
// clang-format off
template <_No_throw_input_range _Rng>
requires destructible<range_value_t<_Rng>>
/* _CONSTEXPR20_DYNALLOC */ borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const noexcept {
_CONSTEXPR20_DYNALLOC borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const noexcept {
// clang-format on
auto _First = _RANGES begin(_Range);
_Seek_wrapped(_First, _RANGES _Destroy_unchecked(_Get_unwrapped(_STD move(_First)), _Uend(_Range)));
Expand All @@ -631,7 +599,7 @@ namespace ranges {

// FUNCTION TEMPLATE destroy_n
template <class _NoThrowFwdIt, class _Diff>
_NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) {
_CONSTEXPR20_DYNALLOC _NoThrowFwdIt destroy_n(_NoThrowFwdIt _First, const _Diff _Count_raw) {
// destroy all elements in [_First, _First + _Count)
_Algorithm_int_t<_Diff> _Count = _Count_raw;
if (_Count <= 0) {
Expand Down Expand Up @@ -661,8 +629,9 @@ namespace ranges {
// clang-format off
template <_No_throw_input_iterator _It>
requires destructible<iter_value_t<_It>>
/* _CONSTEXPR20_DYNALLOC */ _It operator()(_It _First, const iter_difference_t<_It> _Count) const noexcept {
_CONSTEXPR20_DYNALLOC _It operator()(_It _First, const iter_difference_t<_It> _Count_raw) const noexcept {
// clang-format on
_Algorithm_int_t<iter_difference_t<_It>> _Count = _Count_raw;
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
if (_Count <= 0) {
return _First;
}
Expand Down
Loading