Question
// StudentID: xxxxxxxx, Name: AAA BBB CCC #include #include #include #include using String = std::string; template using Vector = std::vector ; template using Tuple =
// StudentID: xxxxxxxx, Name: AAA BBB CCC #include
using String = std::string; template
template
template
// custom user literal _s is declared for easy std::string constant usage such as "hello"_s auto operator"" _s(const char* str, size_t) { return std::string(str); }
// Distinct new classes are derived from already available base classes for you struct Integer { int value; Integer(int value) : value(value) { } };
// A simple struct and its container is declared in a generic way that has 4 dimensions struct Name : String { using String::String; Name(const String& s) : String(s) {};}; struct Surname : String { using String::String; Surname(const String& s) : String(s) {};}; struct BirthYear : Integer { using Integer::Integer; }; struct DeathYear : Integer { using Integer::Integer; }; using Scientist = Tuple
// A simple struct and its container is declared in a generic way that has 2 dimensions struct FullName : String { using String::String; FullName(const String& s) : String(s) {}; }; struct Url : String { using String::String; Url(const String& s) : String(s) {}; }; using Link = Tuple
// Declare necessary concepts, operator overloads, algorithms, their higher order versions, etc. // for to make below code execute and produce the wanted output exactly as described. // WRITE YOUR CODE HERE, DO NOT CHANGE ANY OTHER PLACE
// Below are written for you and shall not be changed. int main(int, char* []) {
auto scientists = Scientists{ {"Charles", "Babbage", 1791, 1871}, {"Ada", "Lovelace", 1815, 1852}, {"Alan", "Turing", 1912, 1954}, }; auto links = Links{ {"Ada Lovelace", "https://en.wikipedia.org/wiki/Ada_Lovelace"}, {"Alan Turing", "https://en.wikipedia.org/wiki/Alan_Turing"}, }; "CS321 Homework:"_s | printer(); print("Q1 - Print 'scientists' and 'links' containers"); scientists | printer("Scientists"); links | printer("Links"); *scientists.begin() | eval_namesurname() | printer("Q2 - Write a lambda that returns 'Name' and 'Surname' concatenated with a space"); scientists | transform(eval_namesurname()) | printer("Q3 - Transform tuples with a new one with 'Name Surname' concatenated"); cartesian(scientists, links) | printer("Q4 - Cartesian Product of two containers") | where([=](const auto& tpl) { return eval_namesurname()(tpl) == get
I want to print 'scientists' and 'links' containers as written in the below:
Scientists (Charles) (Babbage) (1791) (1871) (Ada) (Lovelace) (1815) (1852) (Alan) (Turing) (1912) (1954)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started