diff --git a/tools/HeaderGen/HeaderGen.cpp b/tools/HeaderGen/HeaderGen.cpp index bc4c14f..98644d3 100644 --- a/tools/HeaderGen/HeaderGen.cpp +++ b/tools/HeaderGen/HeaderGen.cpp @@ -10,6 +10,7 @@ #include #include #include +#include using namespace std; struct Compiler @@ -68,11 +69,11 @@ int main(int argc, char* argv[]) } else //if(vendors.empty()) { - cout << "No vendor file provided, using defaults" << endl; + cout << "No vendor file provided, using defaults\n"; vendors.reserve(10); vendors.push_back(Compiler("(_MSC_VER >= 1300)", "MSVC\\1300")); - vendors.push_back(Compiler("(_MSC_VER >= 1200)", "MSVC\\1200")); - vendors.push_back(Compiler("( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 1)) )", "Reference")); + vendors.push_back(Compiler("(__BORLANDC__)", "Borland")); + vendors.push_back(Compiler("( (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ > 95)) )", "Reference")); } fstream header_list(argv[1]); @@ -102,35 +103,65 @@ int main(int argc, char* argv[]) header_file << "/"; header_file << endl; header_file << ss.str(); - header_file << "//Forwards to the appropriate code" << endl; - header_file << "// that works on the detected compiler" << endl; + header_file << "//Forwards to the appropriate code\n"; + header_file << "// that works on the detected compiler\n"; + time_t rawtime; time(&rawtime); + header_file << "//Generated on " << ctime(&rawtime); header_file << endl << endl; cv_t::iterator it=vendors.begin(), itEnd = vendors.end(); - header_file << "#ifdef LOKI_USE_REFERENCE" << endl; - header_file << "#\tinclude \".\\Reference\\" << header << "\"" << endl; - header_file << "#else" << endl; + header_file << "#ifdef LOKI_USE_REFERENCE\n"; + header_file << "#\tinclude \".\\Reference\\" << header << "\"\n"; + header_file << "#else\n"; header_file << "#\tif " << it->version_test << endl; header_file << "#\t\tinclude \".\\" << it->subdir; - header_file << "\\" << header << "\""<< endl; + header_file << "\\" << header << "\"\n"; ++it; for(; it!=itEnd; ++it) { - header_file << "#elif " << it->version_test << endl; + header_file << "#\telif " << it->version_test << endl; header_file << "#\t\tinclude \".\\" << it->subdir; - header_file << "\\" << header << "\""<< endl; + header_file << "\\" << header << "\"\n"; } - header_file << "#\telse" << endl; - header_file << "\t\t//Define LOKI_USE_REFERENCE and get back to us on the results" << endl; - header_file << "#\t\terror Compiler not tested with Loki, #define LOKI_USE_REFERENCE" << endl; - header_file << "#\tendif" << endl; - header_file << "#endif" << endl; + header_file << "#\telse\n"; + header_file << "\t\t//Define LOKI_USE_REFERENCE and get back to us on the results\n"; + header_file << "#\t\terror Compiler not tested with Loki, #define LOKI_USE_REFERENCE\n"; + header_file << "#\tendif\n"; + header_file << "#endif\n"; } } #ifdef _MSC_VER system("PAUSE"); #endif return 0; - } \ No newline at end of file + } + +#include +#include +#include +struct MyClass +{ +typedef std::vector vector_t; +typedef std::vector vector2D_t; +vector2D_t some_vector; + +void ResizeVector(int x, int y); +}; + +void MyClass::ResizeVector(int x, int y) +{ +this->some_vector.resize(x); +vector2D_t::iterator it, itEnd = this->some_vector.end(); +for(it = this->some_vector.begin(); it!=itEnd; ++it) + it->resize(y); + +//or +std::for_each(this->some_vector.begin(), this->some_vector.end(), +std::mem_fun_ref(&vector_t::size)); + +std::mem_fun_ref(&vector_t::resize)(*this->some_vector.begin(), y); +std::bind2nd(std::mem_fun_ref(&vector_t::resize), 5)(&*this->some_vector.begin()); +//std::for_each(this->some_vector.begin(), this->some_vector.end(),); +} \ No newline at end of file diff --git a/tools/HeaderGen/vendors.lst b/tools/HeaderGen/vendors.lst index 98d636a..98d201b 100644 --- a/tools/HeaderGen/vendors.lst +++ b/tools/HeaderGen/vendors.lst @@ -4,8 +4,11 @@ MSVC\1300 (_MSC_VER >= 1200) MSVC\1200 -( (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ > 1)) ) +(__BORLANDC__) +Borland + +(__MWERKS__) Reference -(__BORLANDC__) -Borland \ No newline at end of file +( (__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)) ) +Reference \ No newline at end of file