<commit_before>#ifndef MONSOON_OBJPIPE_OF_H
#define MONSOON_OBJPIPE_OF_H

///\file
///\ingroup objpipe

#include <array>
#include <type_traits>
#include <monsoon/objpipe/detail/of_pipe.h>
#include <monsoon/objpipe/detail/adapter.h>

namespace monsoon::objpipe {


/**
 * \brief Create an objpipe containing a single value.
 * \ingroup objpipe
 *
 * \details
 * The value is copied during construction of the objpipe.
 *
 * If the argument is an std::reference_wrapper, a reference will be used instead.
 * In this case, the lifetime of the referenced value must exceed the lifetime of the objpipe.
 *
 * \param[in] v The value to iterate over.
 * \return An objpipe iterating over the single argument value.
 * \sa \ref monsoon::objpipe::detail::of_pipe
 */
template<typename T>
constexpr auto of(T&& v)
noexcept(std::is_nothrow_constructible_v<detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>, T>)
-> detail::adapter_t<detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>> {
  return detail::adapter(detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>(std::forward<T>(v)));
}

/**
 * \brief Create an objpipe containing a sequence of values.
 * \ingroup objpipe
 *
 * \details
 * The values are copied during construction of the objpipe.
 *
 * \param[in] values The values to iterate over.
 * \return An objpipe iterating over the argument values.
 * \sa \ref monsoon::objpipe::detail::of_pipe
 */
template<typename T = void, typename... Types>
constexpr auto of(Types&&... values)
noexcept(noexcept(of(std::make_array<T>(std::forward<Types>(values)...))
        .flatten()))
-> decltype(auto) {
  if constexpr(std::is_same_v<void, T>) {
    using type = std::common_type_t<std::remove_cv_t<std::remove_reference_t<Types>>>;
    return of(std::array<type>(std::forward<Types>(values)...))
        .flatten();
  } else {
    return of(std::array<T>(std::forward<Types>(values)...))
        .flatten();
  }
}


} /* namespace monsoon::objpipe */

#endif /* MONSOON_OBJPIPE_OF_H */<commit_msg>Fix noexcept specification of objpipe::of.<commit_after>#ifndef MONSOON_OBJPIPE_OF_H
#define MONSOON_OBJPIPE_OF_H

///\file
///\ingroup objpipe

#include <array>
#include <type_traits>
#include <monsoon/objpipe/detail/of_pipe.h>
#include <monsoon/objpipe/detail/adapter.h>

namespace monsoon::objpipe {


/**
 * \brief Create an objpipe containing a single value.
 * \ingroup objpipe
 *
 * \details
 * The value is copied during construction of the objpipe.
 *
 * If the argument is an std::reference_wrapper, a reference will be used instead.
 * In this case, the lifetime of the referenced value must exceed the lifetime of the objpipe.
 *
 * \param[in] v The value to iterate over.
 * \return An objpipe iterating over the single argument value.
 * \sa \ref monsoon::objpipe::detail::of_pipe
 */
template<typename T>
constexpr auto of(T&& v)
noexcept(std::is_nothrow_constructible_v<detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>, T>)
-> detail::adapter_t<detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>> {
  return detail::adapter(detail::of_pipe<std::remove_cv_t<std::remove_reference_t<T>>>(std::forward<T>(v)));
}

/**
 * \brief Create an objpipe containing a sequence of values.
 * \ingroup objpipe
 *
 * \details
 * The values are copied during construction of the objpipe.
 *
 * \param[in] values The values to iterate over.
 * \return An objpipe iterating over the argument values.
 * \sa \ref monsoon::objpipe::detail::of_pipe
 */
template<typename T = void, typename... Types>
constexpr auto of(Types&&... values)
noexcept(noexcept(
        of(std::array<std::conditional_t<std::is_same_v<void, T>, std::common_type_t<std::remove_cv_t<std::remove_reference_t<Types>>...>, T>>(std::forward<Types>(values...)))
        .flatten()))
-> decltype(auto) {
  using type = std::conditional_t<
      std::is_same_v<void, T>,
      std::common_type_t<std::remove_cv_t<std::remove_reference_t<Types>>...>,
      T>;

  return of(std::array<type>(std::forward<Types>(values)...))
      .flatten();
}


} /* namespace monsoon::objpipe */

#endif /* MONSOON_OBJPIPE_OF_H */
{'fraction_non_alphanumeric': 0.15009699321047526, 'fraction_numerical': 0.0, 'mean_word_length': 4.842776203966006, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 67, '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': '4998664', 'n_tokens_mistral': 1414, 'n_tokens_neox': 1370, 'n_words': 331}