33 #ifndef DRAIN_UNITUPLE
34 #define DRAIN_UNITUPLE
44 #include <drain/StringBuilder.h>
45 #include <drain/TupleBase.h>
46 #include <drain/Type.h>
64 template <
class T,
size_t N=2>
72 static const size_t tuple_size = N;
75 typedef const T* const_iterator;
79 UniTuple() : start(this->arr), init(
nullptr){
84 template<
typename ... TT>
86 UniTuple(
const TT &... args) : start(this->arr), init(
nullptr){
102 UniTuple(std::initializer_list<S> l) : start(this->arr), init(nullptr){
111 tuple_t & operator=(
const tuple_t &t){
118 tuple_t & operator=(
const value_type & value){
125 tuple_t & operator=(std::initializer_list<S> l){
134 const_iterator begin() const override final {
140 const_iterator end() const override final {
146 iterator begin() override final {
153 iterator end() override final {
167 const tuple_t & tuple()
const{
172 void debug(std::ostream & ostr)
const {
173 ostr <<
"UniTuple<" <<
typeid(T).name() <<
sizeof(T) <<
',' << N <<
">: {" << *
this <<
'}';
179 const iterator start;
192 return *(init=begin());
194 else if (init==end()){
195 std::cerr << __FILE__ <<
':' << __FUNCTION__ <<
"warning: exceeded inits: " << *
this << std::endl;
196 return *(init=begin());
205 UniTuple(UniTuple<T,N2> &tuple,
size_t i): start(tuple.begin()+i), init(nullptr){
228 template <
class T,
size_t N>
231 static const std::string & str(){
Definition: StringBuilder.h:58
Definition: TupleBase.h:54
tuplebase_t & assignSequence(T &sequence, bool LENIENT=false)
Proposed for tuples only; derived classes should not shadow this.
Definition: TupleBase.h:244
void fill(T i)
Set all the elements to i.
Definition: TupleBase.h:272
Tuple of N elements of type T.
Definition: UniTuple.h:65
UniTuple(const UniTuple< T, N > &t)
Copy constructor.
Definition: UniTuple.h:94
Definition: DataSelector.cpp:1277
static const std::string name
Default implementation: name returned by std::type_info::name()
Definition: Type.h:558