This struct provides a namespace for a suite of compile‐time constants, types, and pure procedures that provide platform‐dependent alignment information.

Synopsis

Declared in <bsls_alignmentutil.h>

struct AlignmentUtil;

Type Aliases

Name

Description

MaxAlignedType

Alias for a primitive type that has the most stringent alignment requirement.

Enums

Name

Description

Unnamed enum

Maximum alignment supported on the current platform.

Static Member Functions

Name

Description

calculateAlignmentFromSize

Return the natural alignment for a memory block of the specified size.

calculateAlignmentOffset

Return the offset needed to align the specified address.

defaultAlignmentOfAlignedStorage

Return the default std::aligned_storage alignment for t_SIZE.

is2ByteAligned

Return true if the specified address is aligned on a 2‐byte boundary (i.e., the numerical value of address is evenly divisible by 2), and false otherwise.

is4ByteAligned

Return whether the specified address is aligned on a 4‐byte boundary.

is8ByteAligned

Return true if the specified address is aligned on an 8‐byte boundary (i.e., the numerical value of address is evenly divisible by 8), and false otherwise.

isAligned

Return whether the specified address is aligned to the given boundary.

pointerAlignment

Return the alignment of the specified address. Returns 0 if address is 0. Note that the returned value might be larger than BSLS_MAX_ALIGNMENT.

roundUpToMaximalAlignment

Return the specified size rounded up to the maximum alignment.

Friends

Name

Description

BloombergLP::bsls::AlignmentUtil::MaxAlignedUnion

Created with MrDocs