MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / erase

Method erase

extern/json/json.hpp:3937–3992  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3935 std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int>::type
3936 = 0>
3937 IteratorType erase(IteratorType pos)
3938 {
3939 // make sure iterator fits the current value
3940 if (this != pos.m_object)
3941 {
3942 throw std::domain_error("iterator does not fit current value");
3943 }
3944
3945 IteratorType result = end();
3946
3947 switch (m_type)
3948 {
3949 case value_t::boolean:
3950 case value_t::number_float:
3951 case value_t::number_integer:
3952 case value_t::number_unsigned:
3953 case value_t::string:
3954 {
3955 if (not pos.m_it.primitive_iterator.is_begin())
3956 {
3957 throw std::out_of_range("iterator out of range");
3958 }
3959
3960 if (is_string())
3961 {
3962 AllocatorType<string_t> alloc;
3963 alloc.destroy(m_value.string);
3964 alloc.deallocate(m_value.string, 1);
3965 m_value.string = nullptr;
3966 }
3967
3968 m_type = value_t::null;
3969 assert_invariant();
3970 break;
3971 }
3972
3973 case value_t::object:
3974 {
3975 result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
3976 break;
3977 }
3978
3979 case value_t::array:
3980 {
3981 result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
3982 break;
3983 }
3984
3985 default:
3986 {
3987 throw std::domain_error("cannot use erase() with " + type_name());
3988 }
3989 }
3990
3991 return result;
3992 }
3993
3994 /*!

Callers 15

vector_pointer_modifiersFunction · 0.80
setPointsMethod · 0.80
removeMethod · 0.80
normalizePathMethod · 0.80
removeSinkMethod · 0.80
get_insertion_pointMethod · 0.80
fuse_forwardMethod · 0.80
fuse_backwardMethod · 0.80
remove_pointerMethod · 0.80
remove_pointer<false>Method · 0.80
addPropertyMethod · 0.80
addListPropertyMethod · 0.80

Calls 7

endFunction · 0.85
is_beginMethod · 0.80
deallocateMethod · 0.80
is_endMethod · 0.80
sizeFunction · 0.50
destroyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected