Provide a class describing a block of memory.
More...
Namespaces |
namespace | bdlma |
Detailed Description
- Outline
-
-
- Purpose:
- Provide a class describing a block of memory.
-
- Classes:
-
- See also:
-
- Description:
- This component defines an in-core value-semantic class for describing a block of memory, namely
bdlma::MemoryBlockDescriptor
. Each descriptor object contains the address of the block of memory and the size of the block. The distinguished "null" descriptor contains an address and a size that are both 0.
-
- Usage:
- This example demonstrates how to create and test the state of a
bdlma::MemoryBlockDescriptor
. char buffer[100];
bdlma::MemoryBlockDescriptor a(buffer, sizeof buffer);
assert(!a.isNull());
assert(buffer == a.address());
assert(sizeof buffer == a.size());
bdlma::MemoryBlockDescriptor b;
assert( b.isNull());
assert(0 == b.address());
assert(0 == b.size());
assert(a != b);
b = a;
assert(!b.isNull());
assert(buffer == b.address());
assert(sizeof buffer == b.size());
assert(a == b);