Casts the pointer stored in the supplied std::experimental::shared_ptr
instance to the specified
type using dynamic_cast
and returns a std::experimental::shared_ptr
instance holding
the result which shares ownership with the source.
template<typename Target,typename Source) shared_ptr<Target> dynamic_pointer_cast(shared_ptr<Source> const& source);
dynamic_cast<Target*>(source.get())
is well-formed.
If dynamic_cast<Target*>(source.get())!=nullptr
returns a shared_ptr<Target>
that holds the value of dynamic_cast<Target*>(source.get())
and shares ownership with source
. Otherwise returns a default-constructed
shared_ptr<Target>
.
result.get()==dynamic_cast<Target*>(source.get())
.
If result.get()==nullptr
, result.use_count()==0
,
otherwise result.use_count()==source.use_count()
, source.use_count()
is increased by 1, !result.owner_before(source)
, !source.owner_before(result)
.
Nothing.
#include <experimental/atomic>