Question: Trying to write vba code to add and delete repeating item section for specifically named RSCC.

The following code works for adding but cannot figure out how to delete

[Is it possible to add Repeating Section Content Control section with VBA?](https://stackoverflow.com/questions/53883276/is-it-possible-to-add-repeating-section-content-control-section-with-vba)

Answer: 
This is Undefined Behavior.

From [dcl.type.cv],

> 
> Any attempt to modify a const object during its lifetime results in
> undefined behavior.
> 
> 
> 

Adding the `mutable` specifier to `buffer` will allow it to be modified by a `const` member function.
From [[class.mfct.non-static.general/4]](https://eel.is/c++draft/class.mfct.non-static):

> 
> A non-static member function may be declared `const` [...]. These cv-qualifiers affect the type of the `this` pointer. They also affect the function type of the member function; a member function declared `const` is a *const* member function [...].
> 
> 
> 

Then from [[class.this/1]](https://eel.is/c++draft/class.mfct.non-static#class.this):

> 
> The type of `this` in a member function whose type has a *cv-qualifier-seq cv* and whose class is `x` is "pointer to cv x". [*Note 1*: Thus in a const member function, the object for which the function is called is accessed through a **const access path**. -- *end note*]
> 
> 
> 

And eventually from [[dcl.type.cv/3-4]](https://timsong-cpp.github.io/cppwp/n4861/dcl.type.cv):

> 
> [...] a const-qualified access path **cannot be used to modify an object** [...]
> 
> 
> 

> 
> Any attempt to modify a const object during its lifetime results in **undefined behavior**.
> 
> 
> 

Hence, your `test()` routine shows undefined behavior, and that even if your Wrapper object `object_wrapper`wasn't `const`.