File: template_function.h

package info (click to toggle)
breathe 4.36.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,224 kB
  • sloc: python: 12,703; cpp: 1,737; makefile: 523; xml: 168; sh: 54; ansic: 52
file content (43 lines) | stat: -rw-r--r-- 938 bytes parent folder | download | duplicates (5)
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
#include <string>

/**
 * @brief a function with one template arguments
 * 
 * @tparam T this is the template parameter
 * 
 * @param arg1 argument of type T
 * 
 * @return return value of type T
 */
template <typename T>
T function1(T arg1)
{}


/**
 * @brief a function with one template argument specialized for `std::string`
 *
 * @param arg1 argument of type `std::string`
 *
 * @return return value of type `std::string`
 */
template <>
std::string function1<std::string>(std::string arg1)
{}


/**
 * @brief a function with three template arguments
 * 
 * @tparam T this is the first template parameter
 * @tparam U this is the second template parameter
 * @tparam N this is the third template parameter, it is a non-type parameter
 * 
 * @param arg1 first argument of type T
 * @param arg2 second argument of type U
 * 
 * @return return value of type T
 */
template <typename T, typename U, int N>
T function2(T arg1, U arg2)
{}