Created
January 3, 2018 12:24
-
-
Save joboccara/48c5e129898b83bc5eea402a2755a023 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <boost/parameter.hpp> | |
BOOST_PARAMETER_NAME(firstName) | |
BOOST_PARAMETER_NAME(lastName) | |
BOOST_PARAMETER_NAME(age) | |
BOOST_PARAMETER_NAME(email) | |
BOOST_PARAMETER_FUNCTION( | |
(void), | |
displayPerson, | |
tag, | |
(optional | |
(email, (std::string), "No email provided") | |
) | |
(deduced | |
(required | |
(firstName, (std::string)) | |
(lastName, (std::string)) | |
(age, (int)) | |
) | |
) | |
) | |
{ | |
std::cout << "First name: "<< firstName << '\n'; | |
std::cout << "Last name: "<< lastName << '\n'; | |
std::cout << "Age: "<< age << '\n'; | |
std::cout << "Email: "<< email << '\n'; | |
} | |
int main() | |
{ | |
displayPerson(_age = 42, _lastName = "Doe", _firstName = "John"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment