<commit_before>/**
 * @file   AnyPod.hpp
 * @brief  AnyPod class prototype.
 * @author zer0
 * @date   2018-01-16
 */

#ifndef __INCLUDE_LIBTBAG__LIBTBAG_CONTAINER_ANYPOD_HPP__
#define __INCLUDE_LIBTBAG__LIBTBAG_CONTAINER_ANYPOD_HPP__

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libtbag/config.h>
#include <libtbag/predef.hpp>
#include <libtbag/type/TypeTable.hpp>

#include <cstdint>
#include <cstring>
#include <utility>
#include <algorithm>

// -------------------
NAMESPACE_LIBTBAG_OPEN
// -------------------

namespace container {

union UnionData
{
    bool                   b;
    char                   c;
    signed char           sc;
    unsigned char         uc;
    wchar_t               wc;
    char16_t             c16;
    char32_t             c32;
    short                  s;
    unsigned short        us;
    int                    i;
    unsigned int          ui;
    long                   l;
    unsigned long         ul;
    long long             ll;
    unsigned long long   ull;
    float                  f;
    double                 d;
    long double           ld;
    void*                  p;
};

/**
 * AnyPod class prototype.
 *
 * @author zer0
 * @date   2018-01-16
 */
class AnyPod
{
public:
    template <typename T>
    using TypeInfo  = type::TypeInfo<T>;
    using TypeTable = type::TypeTable;

public:
    TBAG_CONSTEXPR std::size_t size() const TBAG_NOEXCEPT { return sizeof(UnionData); }

public:
    TypeTable type;
    UnionData data;

public:
    template <typename T>
    inline AnyPod(T d, TypeTable t = TypeInfo<T>::table()) : type(t), data()
    { ::memcpy(&data, &d, sizeof(T)); }<commit_msg>Fixed build error in GCC.<commit_after>/**
 * @file   AnyPod.hpp
 * @brief  AnyPod class prototype.
 * @author zer0
 * @date   2018-01-16
 */

#ifndef __INCLUDE_LIBTBAG__LIBTBAG_CONTAINER_ANYPOD_HPP__
#define __INCLUDE_LIBTBAG__LIBTBAG_CONTAINER_ANYPOD_HPP__

// MS compatible compilers support #pragma once
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif

#include <libtbag/config.h>
#include <libtbag/predef.hpp>
#include <libtbag/type/TypeTable.hpp>

#include <cstdint>
#include <cstring>
#include <utility>
#include <algorithm>

// -------------------
NAMESPACE_LIBTBAG_OPEN
// -------------------

namespace container {

union UnionData
{
    bool                   b;
    char                   c;
    signed char           sc;
    unsigned char         uc;
    wchar_t               wc;
    char16_t             c16;
    char32_t             c32;
    short                  s;
    unsigned short        us;
    int                    i;
    unsigned int          ui;
    long                   l;
    unsigned long         ul;
    long long             ll;
    unsigned long long   ull;
    float                  f;
    double                 d;
    long double           ld;
    void*                  p;
};

/**
 * AnyPod class prototype.
 *
 * @author zer0
 * @date   2018-01-16
 */
class AnyPod
{
public:
    template <typename T>
    using TypeInfo  = type::TypeInfo<T>;
    using TypeTable = type::TypeTable;

public:
    TBAG_CONSTEXPR static std::size_t size() TBAG_NOEXCEPT { return sizeof(UnionData); }

public:
    TypeTable type;
    UnionData data;

public:
    template <typename T>
    inline AnyPod(T d, TypeTable t = TypeInfo<T>::table()) : type(t), data()
    { ::memcpy(&data, &d, sizeof(T)); }
{'fraction_non_alphanumeric': 0.11759607049985553, 'fraction_numerical': 0.017336030049118753, 'mean_word_length': 1.7919354838709678, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5497691', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1090, 'n_words': 286}