[#BloombergLP-bslstl-SharedPtrUtil-constCast-07] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::xref:BloombergLP/bslstl/SharedPtrUtil.adoc[SharedPtrUtil]::constCast :relfileprefix: ../../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class TARGET, class SOURCE> static xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<TARGET>] constCast(xref:bsl/shared_ptr-0a.adoc[bsl::shared_ptr<SOURCE>] const& source) noexcept; ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#