Say. As I read, I seem to find that the use of <cstdarg> in C++ frowned upon. I can see why -- it's not necessary, and is not typesafe. However, suppose I wanted to implement my a matrix class such that operator() will take as many arguments as there are dimensions specified by the template. So that:
Code:
matrix<dimension(5), double> tesseract;
tesseract(1,5,3,0,1) = 4.5567;
Is safe code? I implemented it with va_args, but I have no way of knowing how many arguments the user stuck in. This seems to be an unavoidable truth.
I figured I could have the function accept as arguments a type of class that casts implicity as an integer, and can also serve as an "arguments stop here" specifier. But this adds notational inconvenience.
Code:
tesseract(1,5,3,0,1,end_components) = 4.5567;
I don't like this. If I were to go through that much trouble, then I might as well use the obvious C++ solution:
Code:
typedef basic_tuplet<5> tuplet;
tesseract(tuplet(1,5,3,0,1)) = 4.5567;
Yet I prefer (aesthetically) the old non-typesafe code. Where is the compromise?