MCPcopy Create free account
hub / github.com/andreasfertig/programming-with-cpp20 / ~optional

Method ~optional

01.29-optional4/main.cpp:29–33  ·  view source on GitHub ↗

#A Only if not trivially destructible

Source from the content-addressed store, hash-verified

27
28 // #A Only if not trivially destructible
29 ~optional()
30 requires(not std::is_trivially_destructible_v<T>)
31 {
32 if(has_value) { value.as()->~T(); }
33 }
34
35 // #B If not trivially destructible and has Release method
36 ~optional()

Callers

nothing calls this directly

Calls 2

asMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected