File: two.hpp

package info (click to toggle)
exhale 0.3.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,616 kB
  • sloc: python: 9,057; cpp: 1,260; javascript: 915; f90: 29; ansic: 18; makefile: 16
file content (42 lines) | stat: -rw-r--r-- 1,745 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/***************************************************************************************
 * This file is dedicated to the public domain.  If your jurisdiction requires a       *
 * specific license:                                                                   *
 *                                                                                     *
 * Copyright (c) Stephen McDowell, 2017-2024                                           *
 * License:      CC0 1.0 Universal                                                     *
 * License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode           *
 **************************************************************************************/
/**
 * \file
 *
 * \brief This file should be one level down in the hierarchy.
 */
#pragma once

namespace nested {
    /// The second class inside the ``nested`` namespace.
    struct two {
        /// Nesting even further: ``nested::two::params``.
        struct params {
            /// A union that occupies four bytes: https://en.cppreference.com/w/cpp/language/union
            union four_bytes {
                std::int32_t n;    ///< occupies 4 bytes
                std::uint16_t s[2];///< occupies 4 bytes
                std::uint8_t c;    ///< occupies 1 byte
            };

            /// Returns ``true`` ;)
            bool compiles() { return true; }
        };

        /// Returns ``true`` ;)
        bool compiles() { return true; }
    };

    /// A union that occupies four bytes: https://en.cppreference.com/w/cpp/language/union
    union four_bytes {
        std::int32_t n;    ///< occupies 4 bytes
        std::uint16_t s[2];///< occupies 4 bytes
        std::uint8_t c;    ///< occupies 1 byte
    };
}