<commit_before>// Copyright (c) 2011 <NAME> <<EMAIL>>
//
// This file is part of libsfz, a free software project.  You can redistribute it and/or modify it
// under the terms of the MIT License.

#ifndef SFZ_OPTIONAL_HPP_
#define SFZ_OPTIONAL_HPP_

#include <stdint.h>
#include <stdlib.h>
#include <stdexcept>

namespace sfz {

struct _nullopt_t {};

constexpr _nullopt_t nullopt;

template <typename T>
class optional {
  public:
    optional(_nullopt_t = nullopt);
    optional(const optional& other);
    optional(optional&& other);
    optional& operator=(_nullopt_t);
    optional& operator=(const optional& other);
    optional& operator=(optional&& other);
    ~optional();

    constexpr operator bool() const { return has_value(); }
    constexpr bool has_value() const { return _has_value; }

    T* operator->() { return data(); }
    const T* operator->() const { return data(); }
    T& operator*() { return *data(); }
    const T& operator*() const { return *data(); }

    T&       value() { return *exception_or(data()); }
    const T& value() const { return *exception_or(data()); }
    template <typename U>
    T value_or(U&& u) const& { return has_value() ? *data() : u; }
    template <typename U>
    T value_or(U&& u) && { return std::move(has_value() ? *data() : u); }

    void swap(optional& other);
    void reset();
    template <typename... Args>
    void emplace(Args&&... args);<commit_msg>Initialize sfz::nullopt<commit_after>// Copyright (c) 2011 <NAME> <<EMAIL>>
//
// This file is part of libsfz, a free software project.  You can redistribute it and/or modify it
// under the terms of the MIT License.

#ifndef SFZ_OPTIONAL_HPP_
#define SFZ_OPTIONAL_HPP_

#include <stdint.h>
#include <stdlib.h>
#include <stdexcept>

namespace sfz {

struct _nullopt_t {};

constexpr _nullopt_t nullopt{};

template <typename T>
class optional {
  public:
    optional(_nullopt_t = nullopt);
    optional(const optional& other);
    optional(optional&& other);
    optional& operator=(_nullopt_t);
    optional& operator=(const optional& other);
    optional& operator=(optional&& other);
    ~optional();

    constexpr operator bool() const { return has_value(); }
    constexpr bool has_value() const { return _has_value; }

    T* operator->() { return data(); }
    const T* operator->() const { return data(); }
    T& operator*() { return *data(); }
    const T& operator*() const { return *data(); }

    T&       value() { return *exception_or(data()); }
    const T& value() const { return *exception_or(data()); }
    template <typename U>
    T value_or(U&& u) const& { return has_value() ? *data() : u; }
    template <typename U>
    T value_or(U&& u) && { return std::move(has_value() ? *data() : u); }

    void swap(optional& other);
    void reset();
    template <typename... Args>
    void emplace(Args&&... args);
{'fraction_non_alphanumeric': 0.1506657323055361, 'fraction_numerical': 0.002803083391730904, 'mean_word_length': 3.63474025974026, 'pattern_counts': {'":': 0, '<': 23, '<?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': '4501057', 'n_tokens_mistral': 915, 'n_tokens_neox': 898, 'n_words': 288}