File: overloading2.cpp

package info (click to toggle)
seqan3 3.0.2%2Bds-9
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 16,052 kB
  • sloc: cpp: 144,641; makefile: 1,288; ansic: 294; sh: 228; xml: 217; javascript: 50; python: 27; php: 25
file content (25 lines) | stat: -rw-r--r-- 580 bytes parent folder | download
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
#include <iostream>                 // for std::cout

#include <seqan3/std/concepts>      // GCC7 - GCC9 or
//#include <concepts>               // compilers with full C++20 support

template <std::integral t>
void print(t const v)
{
    std::cout << "integral value: " << v << '\n';
}

template <std::unsigned_integral t>
void print(t const v)
{
    std::cout << "Unsigned value: " << v << '\n';
}

int main()
{
    int i{4};
    unsigned u{3};

    print(i);                       // prints "integral value: 4"
    print(u);                       // prints "Unsigned value: 3"
}