-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathcpp_function_template.hpp
More file actions
76 lines (60 loc) · 2.35 KB
/
cpp_function_template.hpp
File metadata and controls
76 lines (60 loc) · 2.35 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Copyright (C) 2017-2023 Jonathan Müller and cppast contributors
// SPDX-License-Identifier: MIT
#ifndef CPPAST_CPP_FUNCTION_TEMPLATE_HPP_INCLUDED
#define CPPAST_CPP_FUNCTION_TEMPLATE_HPP_INCLUDED
#include <cppast/cpp_function.hpp>
#include <cppast/cpp_template.hpp>
namespace cppast
{
/// A [cppast::cpp_entity]() modelling a function template.
class cpp_function_template final : public cpp_template
{
public:
static cpp_entity_kind kind() noexcept;
/// Builder for [cppast::cpp_function_template]().
class builder : public basic_builder<cpp_function_template, cpp_function_base>
{
public:
using basic_builder::basic_builder;
};
/// A reference to the function that is being templated.
const cpp_function_base& function() const noexcept
{
return static_cast<const cpp_function_base&>(*begin());
}
private:
cpp_function_template(std::unique_ptr<cpp_function_base> func)
: cpp_template(std::unique_ptr<cpp_entity>(func.release()))
{}
cpp_entity_kind do_get_entity_kind() const noexcept override;
friend basic_builder<cpp_function_template, cpp_function_base>;
};
/// A [cppast::cpp_entity]() modelling a function template specialization.
class cpp_function_template_specialization final : public cpp_template_specialization
{
public:
static cpp_entity_kind kind() noexcept;
/// Builder for [cppast::cpp_function_template_specialization]().
class builder
: public specialization_builder<cpp_function_template_specialization, cpp_function_base>
{
public:
using specialization_builder::specialization_builder;
private:
using specialization_builder::add_parameter;
};
/// A reference to the function that is being specialized.
const cpp_function_base& function() const noexcept
{
return static_cast<const cpp_function_base&>(*begin());
}
private:
cpp_function_template_specialization(std::unique_ptr<cpp_function_base> func,
cpp_template_ref primary)
: cpp_template_specialization(std::unique_ptr<cpp_entity>(func.release()), primary)
{}
cpp_entity_kind do_get_entity_kind() const noexcept override;
friend specialization_builder<cpp_function_template_specialization, cpp_function_base>;
};
} // namespace cppast
#endif // CPPAST_CPP_FUNCTION_TEMPLATE_HPP_INCLUDED