MCPcopy Create free account
hub / github.com/AllentDan/LibtorchTutorials / assert_invariant

Function assert_invariant

lesson6-Segmentation/json.hpp:17710–17716  ·  view source on GitHub ↗

! @brief checks the class invariants This function asserts the class invariants. It needs to be called at the end of every constructor to make sure that created objects respect the invariant. Furthermore, it has to be called each time the type of a JSON value is changed, because the invariant expresses a relationship between @a m_type and @a m_value. */

Source from the content-addressed store, hash-verified

17708 @a m_type and @a m_value.
17709 */
17710 void assert_invariant() const noexcept
17711 {
17712 JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr);
17713 JSON_ASSERT(m_type != value_t::array || m_value.array != nullptr);
17714 JSON_ASSERT(m_type != value_t::string || m_value.string != nullptr);
17715 JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr);
17716 }
17717
17718 public:
17719 //////////////////////////

Callers 10

basic_jsonFunction · 0.85
json.hppFile · 0.85
~basic_jsonFunction · 0.85
operator[]Function · 0.85
eraseFunction · 0.85
push_backFunction · 0.85
emplace_backFunction · 0.85
emplaceFunction · 0.85
updateFunction · 0.85
swapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected