aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yson_pull/detail/format_string.h
blob: 683fd1bf361a31fab20ef830590552eada80d124 (plain) (blame)
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
#pragma once

#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/string/builder.h>

namespace NYsonPull {
    namespace NDetail {
        namespace NImpl {
            inline void apply_args(TStringBuilder&) {
            }

            template <typename T, typename... Args>
            inline void apply_args(TStringBuilder& builder, T&& arg, Args&&... args) {
                apply_args(builder << arg, std::forward<Args>(args)...);
            }
        }

        template <typename... Args>
        TString format_string(Args&&... args) {
            TStringBuilder builder;
            NImpl::apply_args(builder, std::forward<Args>(args)...);
            return TString(std::move(builder));
        }
    }
}