I was trying to implement a n-tuple from scratch starting with the mathematical base ordered-pair where n-tuple (a,b,c) = ordered_pair(a,ordered_pair(b,c)) and ordered pair is a set representation ie. ordered_pair(a,b) = set{{a},{a,b}}
here is the code for ordered_pair
#include <iostream>
#include <set>
#include <boost/variant.hpp>
using namespace std;
template <typename T, typename U, typename Z>
class orderd_pair{
//typedef boost::variant<int,std::string,double> cell;
private:
set<set<Z>> opair;
set<T> first;
set<U> second;
public:
set<set<Z>> Orderd_pair(T first_element, U second_element){
first.insert(first_element);
second.insert(first_element);
second.insert(second_element);
opair.insert(first);
opair.insert(second);
return opair;
}
//TO DO void print_elements(std::set<std::set<cell>> opair);*/
};
the problem is when trying to implement tuple set of each ordered_pair must be nested ie for three element tuple set{{a},{a,{{b},{b,c}}}} and for more elements it will be nested even more making it hard to work with, how can I solve this??
also I have used boost::variant to support int,std::string and double data types.