# dmd.dstruct

Struct and union declarations.

Specification: Structs, Unions

#### Authors

Walter Bright

#### License

Boost License 1.0

Source: dstruct.d

Documentation: https://dlang.org/phobos/dmd_dstruct.html

Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dstruct.d

- `search_toString`

  #### Declaration

  `FuncDeclaration `search_toString`(StructDeclaration `sd`);`

  Search `sd` for a member function of the form: `extern (D) string toString();`

  #### Parameters

  `StructDeclaration `sd`` | struct declaration to search

  #### Return Value

  FuncDeclaration of `toString()` if found, `null` if not

- `semanticTypeInfo`

  #### Declaration

  `void `semanticTypeInfo`(Scope* `sc`, Type `t`);`

  Request additional semantic analysis for TypeInfo generation.

  #### Parameters

  `Scope* `sc`` | context
  `Type `t`` | type that TypeInfo is being generated for

- `StructDeclaration`

  #### Declaration

  `class `StructDeclaration`: dmd.aggregate.AggregateDeclaration;`

  All `struct` declarations are an instance of this.

  - `determineTypeProperties`

    #### Declaration

    `final void `determineTypeProperties`();`

    Compute cached type properties for `TypeStruct`

  - `isPOD`

    #### Declaration

    `final bool `isPOD`();`

    Determine if struct is POD (Plain Old Data).

    #### Discussion

    POD is defined as:

    1. not nested
    2. no postblits, destructors, or assignment operators
    3. no `ref` fields or fields that are themselves non-POD
    The idea being these are compatible with C structs.

    #### Return Value

    `true` if struct is POD

  - `hasCopyConstruction`

    #### Declaration

    `final bool `hasCopyConstruction`();`

    Determine if struct has copy construction (copy constructor or postblit)

    #### Return Value

    `true` if struct has copy construction

  - `hasRegularCtor`

    #### Declaration

    `final bool `hasRegularCtor`(bool `checkDisabled` = false);`

    Verifies whether the struct declaration has a constructor that is not a copy constructor. Optionally, it can check whether the struct declaration has a regular constructor, that is not disabled.

    #### Parameters

    `bool `checkDisabled`` | if the struct has a regular non-disabled constructor

    #### Return Value

    `true`, if the struct has a regular (optionally, not disabled) constructor, `false` otherwise.

- `UnionDeclaration`

  #### Declaration

  `class `UnionDeclaration`: dmd.dstruct.StructDeclaration;`

  Unions are a variation on structs.