T
is not a reference type, but ValueType
, so according to the documentation you quoted, you get a value.
You are then trying to bind this [temporary] value to a ref-to-non-const
.
The clause you are trying to activate is:
if
T
is a reference to (possibly const qualified)ValueType
, it returns a reference to the held value.
So, let's make T
a reference to ValueType
:
boost::any_cast<ParameterGroup&>(table[token].value);
// ^^^^^^^^^^^^^^^
// |------------||
// ValueType (ref)
// |-------------|
// T
Now you'll get a reference to the held value, which'll bind just fine to the return type.