#include <bdlb_nullableallocatedvalue.h>
List of all members.
Detailed Description
template<class TYPE>
class bdlb::NullableAllocatedValue< TYPE >
This template class extends the set of values of its value-semantic TYPE
parameter to include the notion of a "null" value. If TYPE
is fully value-semantic, then the augmented type NullableAllocatedValue<TYPE>
will be as well. In addition to supporting all homogeneous value-semantic operations, conversions between comparable underlying value types is also supported. Two nullable objects with different underlying types compare equal if their underlying types are comparable and either (1) both objects are null or (2) the non-null values compare equal. Attempts to copy construct, copy assign, or compare incompatible values types will fail to compile. The NullableAllocatedValue
template can be instantiated on an incomplete type, but it cannot be instantiated on a type that overloads operator&
.
See Component bdlb_nullableallocatedvalue
Member Typedef Documentation
Constructor & Destructor Documentation
Create a nullable object having the null value. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
Create a nullable object having the value of the specified original
object. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
Create a nullable object having the specified value
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
Member Function Documentation
Assign to this object the value of the specified rhs
, and return a reference providing modifiable access to this object.
Assign to this object the value of the specified rhs
, and return a reference providing modifiable access to the underlying TYPE
object.
Efficiently exchange the value of this object with the value of the specified other
object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless this object was created with the same allocator as other
.
Assign to this object the specified value
, and return a reference providing modifiable access to the underlying TYPE
object.
Assign to this object the default value for TYPE
, and return a reference providing modifiable access to the underlying TYPE
object.
template<class TYPE>
template<class STREAM >
Assign to this object the value read from the specified input stream
using the specified version
format, and return a reference to stream
. If stream
is initially invalid, this operation has no effect. If version
is not supported, this object is unaltered and stream
is invalidated, but otherwise unmodified. If version
is supported but stream
becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from stream
. See the bslx
package-level documentation for more information on BDEX streaming of value-semantic types and containers.
Reset this object to the default constructed state (i.e., to have the null value).
Return a reference providing modifiable access to the underlying TYPE
object. The behavior is undefined unless this object is non-null.
template<class TYPE>
template<class STREAM >
Write the value of this object, using the specified version
format, to the specified output stream
, and return a reference to stream
. If stream
is initially invalid, this operation has no effect. If version
is not supported, stream
is invalidated, but otherwise unmodified. Note that version
is not written to stream
. See the bslx
package-level documentation for more information on BDEX streaming of value-semantic types and containers.
Return true
if this object is null, and false
otherwise.
Return the maximum valid BDEX format version, as indicated by the specified versionSelector
, to be passed to the bdexStreamOut
method. Note that it is highly recommended that versionSelector
be formatted as "YYYYMMDD", a date representation. Also note that versionSelector
should be a compile-time-chosen value that selects a format version supported by both externalizer and unexternalizer. See the bslx
package-level documentation for more information on BDEX streaming of value-semantic types and containers.
Return the most current BDEX streaming version number supported by this class. (See the package-group-level documentation for more information on BDEX streaming of container types.)
Return the allocator used by this object to supply memory.
Format this object to the specified output stream
at the (absolute value of) the optionally specified indentation level
and return a reference to stream
. If level
is specified, optionally specify spacesPerLevel
, the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level
). If stream
is not valid on entry, this operation has no effect.
Return a reference providing non-modifiable access to the underlying TYPE
object. The behavior is undefined unless this object is non-null.
The documentation for this class was generated from the following file: