BloombergLP::bslstl::SharedPtrUtil::constCast

Return a bsl::shared_ptr<TARGET> object sharing ownership of the same object as the specified source shared pointer to the (template parameter) SOURCE type, and referring to const_cast<TARGET *>(source.get()). Note that a compiler diagnostic will be emitted indicating an error unless const_cast<TARGET *>(source.get()) is a valid expression.

Synopsis

Declared in <bslstl_sharedptr.h>

template<
    class TARGET,
    class SOURCE>
static
bsl::shared_ptr<TARGET>
constCast(bsl::shared_ptr<SOURCE> const& source) noexcept;