-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicCombiningTemplate.cpp
More file actions
37 lines (32 loc) · 938 Bytes
/
BasicCombiningTemplate.cpp
File metadata and controls
37 lines (32 loc) · 938 Bytes
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
/*
* =====================================================================================
*
* Filename: BasicCombiningTemplate.cpp
*
* Description: Basic Combining Template
*
* Created: 26/07/2020
*
* Author: Maikol Guzmán mikeguzman@gmail.com
* Organization: Universidad Nacional de Costa Rica
*
* =====================================================================================
*/
#include <iostream> // allows program to output data to the screen
template<typename T>
struct MyStruct
{
T data;
};
template<typename U>
auto make_struct(U u)
{
return MyStruct<U>{ u };
}
// function main begins program execution
int main(int argc, const char *argv[]) {
std::cout << "Welcome to the UNA!" << std::endl; // display message
auto f = make_struct(5);
std::cout << f.data << '\n';
return 0; // indicate that program ended successfully
} // end function main