summaryrefslogtreecommitdiffstats
path: root/src/qdoc/catch_generators/src/catch_generators/utilities/semantics/copy_value.h
blob: 57798be1a9cae4ab4e6d986901de2d10643e6a74 (plain)
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
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include "../../namespaces.h"

#include <type_traits>

namespace QDOC_CATCH_GENERATORS_UTILITIES_ABSOLUTE_NAMESPACE {

    /*!
     * Forces \value to be copied in an expression context.
     *
     * This is used in contexts where inferences of a type that
     * requires generality might identify a reference when ownership
     * is required.
     *
     * Note that the compiler might optmize the copy away. This is a
     * non-issue as we are only interested in breaking lifetime
     * dependencies.
     */
    template<typename T>
    std::remove_reference_t<T> copy_value(T value) { return value; }

} // end QDOC_CATCH_GENERATORS_UTILITIES_ABSOLUTE_NAMESPACE