mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Add feature test for literal constructor in downlevel compilers
This commit is contained in:
parent
b77eaa87ee
commit
248a7cbdce
@ -109,7 +109,11 @@ public:
|
|||||||
using handler = void (*)();
|
using handler = void (*)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cpp_constexpr) && __cpp_constexpr >= 201806
|
||||||
constexpr contract_group (handler h) { set_handler(h); }
|
constexpr contract_group (handler h) { set_handler(h); }
|
||||||
|
#else
|
||||||
|
constexpr contract_group (handler h) : chandler(h ? h : []()noexcept{}) { }
|
||||||
|
#endif
|
||||||
constexpr auto set_handler(handler h) -> handler { return std::exchange(chandler, h ? h : []()noexcept{}); }
|
constexpr auto set_handler(handler h) -> handler { return std::exchange(chandler, h ? h : []()noexcept{}); }
|
||||||
constexpr auto get_handler() -> handler { return chandler; }
|
constexpr auto get_handler() -> handler { return chandler; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user