kyopro library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Chipppppppppp/kyopro

:heavy_check_mark: kpr/io/io_option.hpp

Required by

Verified with

Code

#pragma once
#include <cstddef>
#include <tuple>
#include <utility>

namespace kpr {
    template<class Tuple, std::size_t idx>
    struct Indexed {
        Tuple args_tuple;
        template<class... Args>
        constexpr Indexed(Args&&... args) noexcept: args_tuple{std::forward<Args>(args)...} {}
    };

    template<std::size_t i, class... Args>
    constexpr auto indexed(Args&&... args) noexcept {
        return Indexed<std::tuple<Args...>, i>{std::forward<Args>(args)...};
    }

    template<class... Args>
    constexpr auto idx1(Args&&... args) noexcept {
        return indexed<1>(std::forward<Args>(args)...);
    }

    template<class Tuple, bool... seps>
    struct SepWith {
        Tuple args_tuple;
        template<class... Args>
        constexpr SepWith(Args&&... args) noexcept: args_tuple{std::forward<Args>(args)...} {}
    };

    template<bool... seps, class... Args>
    constexpr auto sep_with(Args&&... args) noexcept {
        return SepWith<std::tuple<Args...>, seps...>{std::forward<Args>(args)...};
    }
} // namespace kpr
#line 2 "kpr/io/io_option.hpp"
#include <cstddef>
#include <tuple>
#include <utility>

namespace kpr {
    template<class Tuple, std::size_t idx>
    struct Indexed {
        Tuple args_tuple;
        template<class... Args>
        constexpr Indexed(Args&&... args) noexcept: args_tuple{std::forward<Args>(args)...} {}
    };

    template<std::size_t i, class... Args>
    constexpr auto indexed(Args&&... args) noexcept {
        return Indexed<std::tuple<Args...>, i>{std::forward<Args>(args)...};
    }

    template<class... Args>
    constexpr auto idx1(Args&&... args) noexcept {
        return indexed<1>(std::forward<Args>(args)...);
    }

    template<class Tuple, bool... seps>
    struct SepWith {
        Tuple args_tuple;
        template<class... Args>
        constexpr SepWith(Args&&... args) noexcept: args_tuple{std::forward<Args>(args)...} {}
    };

    template<bool... seps, class... Args>
    constexpr auto sep_with(Args&&... args) noexcept {
        return SepWith<std::tuple<Args...>, seps...>{std::forward<Args>(args)...};
    }
} // namespace kpr
Back to top page