Skip to content

Instantly share code, notes, and snippets.

@joboccara
Created January 3, 2018 12:34
Show Gist options
  • Save joboccara/27471301617ab9e852e4eb3132929b79 to your computer and use it in GitHub Desktop.
Save joboccara/27471301617ab9e852e4eb3132929b79 to your computer and use it in GitHub Desktop.
#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, *)
)
)
)
{
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 = "forty-two", _lastName = "Doe", _firstName = "John");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment