The use of the <b>const</b> qualifier can be complicated in some cases, but in this case I don’t think the problem is directly related to it.
In <i>whatever2 </i>you are using the template with pointers to MyClass (<<i>MyClass *</i>>), but the parameter (<i>item</i>) is not a pointer to <i>MyClass</i>. Although it is declared in the function as “<i>const MyClass <b>&</b> item</i>”, inside the function it is not a pointer, it is just a modifiable <i>MyClass </i>object.
I think <i>cons_cast </i>is making it work because in addition to removing the <i>const </i>attribute it is implicitly casting ‘<i>&item</i>’ to <i>’MyClass *</i>’.
If that is correct, then, this should also compile:
<pre>buffer.add( (MyClass *)&item );</pre>
BTW, this is complicated to understand when <i>Item </i>is being substituted by <i><MyClass *></i>:
<pre>add( const Item & item )</pre>
Don’t you think ? 😉