Correct in place factory example code

The example code as given won't work without const qualifiers on the pointer arguments.
This commit is contained in:
Richard Thomson 2024-02-15 09:32:22 -07:00 committed by GitHub
parent 9abd1fc78d
commit bff26e4fa1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -256,13 +256,13 @@ struct C
~C() { delete contained_ ; }
template<class InPlaceFactory>
void construct ( InPlaceFactory const& aFactory, boost::__in_place_factory_base__* )
void construct ( InPlaceFactory const& aFactory, const boost::__in_place_factory_base__* )
{
aFactory.template apply<X>(contained_);
}
template<class TypedInPlaceFactory>
void construct ( TypedInPlaceFactory const& aFactory, boost::__typed_in_place_factory_base__* )
void construct ( TypedInPlaceFactory const& aFactory, const boost::__typed_in_place_factory_base__* )
{
aFactory.apply(contained_);
}