mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Added workaround for non-constexpr std::exchange
This commit is contained in:
parent
248a7cbdce
commit
0c5a66b666
@ -114,7 +114,15 @@ public:
|
||||
#else
|
||||
constexpr contract_group (handler h) : chandler(h ? h : []()noexcept{}) { }
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 202002L
|
||||
constexpr auto set_handler(handler h) -> handler { return std::exchange(chandler, h ? h : []()noexcept{}); }
|
||||
#else
|
||||
constexpr auto set_handler(handler h) -> handler { auto old = chandler;
|
||||
chandler = h ? h : []()noexcept{};
|
||||
return old;
|
||||
}
|
||||
#endif
|
||||
constexpr auto get_handler() -> handler { return chandler; }
|
||||
|
||||
constexpr void expects (bool b) { assertion(b); }
|
||||
|
Loading…
Reference in New Issue
Block a user