When I define many functions which are required to receive more than one type of parameter, I end up using template <typename T>
many times, like so:
#pragma once
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;
class Unlint {
vector<bitset<8>> bitarray;
public:
template <typename T>
Unlint(T varx);
template <typename T>
Unlint operator + (T varx);
template <typename T>
Unlint operator - (T varx);
//...
};
Repeating code like this feels dirty. Are there any non-repetitive methods?
For context, I'm trying to code Unlint
as an int-like object with essentially no limit, for my own practice.