1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

#include <iostream>
#include "FILE_txt.h"
int main()
{
FILE_txt myfile("fullpath");
double (&array1)[3] = *new double[1][3] {2,3,4};
double array2 [3] = {2,3,4};
double (&array3)[4] = *new double[1][4] {2,3,4};
double array4 [4] = {2,3,4};
double (&array5)[2] = *new double[1][2] {2,3};
double array6 [2] = {2,3};
// The following lines call function
// template<class T>
// void FILE_txt::save_Data_inFile(const T (&data)[3])
// or
// template<class T, size_t N>
// typename std::enable_if<(N>=3)>::type FILE_txt::save_Data_inFile(const T (&data)[N])
// If both signatures were available, this would cause an
// ambiguity error since both would match.
myfile.save_Data_inFile(array1);
myfile.save_Data_inFile(array2);
// The following lines call function
// template<class T, size_t N>
// typename std::enable_if<(N>=3)>::type FILE_txt::save_Data_inFile(const T (&data)[N])
myfile.save_Data_inFile(array3);
myfile.save_Data_inFile(array4);
// The following fails to compile due to type mismatch:
myfile.save_Data_inFile(array5);
myfile.save_Data_inFile(array6);
// The following would fail as there's no function that takes a pointer even
// though numbers is a pointer to a type that would have been valid.
// If your 2nd function signature example was available, it would be called
// which would be incorrect for the 1st call using number as a parameter.
double *number = new number(3);
double *numbers = array2;
myfile.save_Data_inFile(number);
myfile.save_Data_inFile(numbers);
delete number; // delete number
delete[] &array1; // delete elements in array1
delete[] &array3; // delete elements in array3
delete[] &array5; // delete elements in array5
std::cin.get();
return 0;
}
