aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/identity.h
blob: 9f519571c2d7ea8e70c62f2d180ec75ceaae8071 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <utility>

namespace vespalib {

// Functor which returns its argument unchanged.
// Functionally identical to C++20's std::identity
// TODO remove and replace with std::identity once it is available.
struct Identity {
    template <typename T>
    constexpr T&& operator()(T&& v) const noexcept {
        return std::forward<T>(v);
    }
};

}