26 #ifndef SRC_XRDCL_XRDCLFWD_HH_
27 #define SRC_XRDCL_XRDCLFWD_HH_
133 struct Fwd :
protected std::shared_ptr<FwdStorage<T>>
169 explicit Fwd(
const T &value )
171 *this->get() = value;
179 *this->get() = std::move( value );
190 *this->get() = value;
202 *this->get() = std::move( value );
215 if( !
bool( this->get()->ptr ) )
throw std::logic_error(
"XrdCl::Fwd contains no value!" );
216 return *this->get()->ptr;
228 if( !
bool( this->get()->ptr ) )
throw std::logic_error(
"XrdCl::Fwd contains no value!" );
229 return this->get()->ptr;
237 return bool( this->get()->ptr );
244 template<
typename T,
typename... Args>
245 inline std::shared_ptr<FwdStorage<T>>
make_fwd( Args&&... args )
247 return std::make_shared<FwdStorage<T>>( std::forward<Args>( args )... );
std::shared_ptr< FwdStorage< T > > make_fwd(Args &&... args)
FwdStorage & operator=(const T &value)
Memory storage
The memory for storying forwarded value.
FwdStorage & operator=(T &&value)
FwdStorage(const T &value)
FwdStorage()
Default constructor.
T * ptr
Pointer to the forwarded value.
Fwd & operator=(const T &value)
Fwd(Fwd &&fwd)
Move constructor.
Fwd(const Fwd &fwd)
Copy constructor.
Fwd(const T &value)
Constructor from value.
Fwd(std::shared_ptr< FwdStorage< T >> &&ptr)
Initialize from shared_ptr.
Fwd & operator=(T &&value)
bool Valid() const
Check if it contains a valid value.
Fwd(T &&value)
Move construct from value.
~Memory()
Make sure the destrutor of T won't be called.
T memory
The memory for storing forwarded value.
Memory()
Make sure the default constructor of T won't be called.