From 8c865b97254c425c002d00374e7c1874c6f15d52 Mon Sep 17 00:00:00 2001 From: magmaikh Date: Thu, 29 Aug 2002 05:54:43 +0000 Subject: [PATCH] no message git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@43 7ec92016-0320-0410-acc4-a06ded1c099a --- tools/HeaderGen/HeaderGen.cpp | 65 ++++++++++++++++++++++++++--------- tools/HeaderGen/vendors.lst | 9 +++-- 2 files changed, 54 insertions(+), 20 deletions(-) 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