#include "D:\Programming\C++\projects\include\pctimer.h"
#include "D:\Programming\C++\projects\include\mstring.h"
int main () {
std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
pctimer_t t1, t2;
t1 = pctimer();
// UNSIGNED
//
std::cout << "\nUNSIGNED ints" << std::endl;
std::vector<unsigned> items;
items.push_back(1);
items.push_back(2);
items.push_back(3);
for (std::vector<unsigned>::iterator i = items.begin(); i != items.end(); i++) {
std::cout << *i;
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPostIncriment (unsigned): This operation took: " << t2 - t1 << " seconds.\n\n";
// Reset the timer.
t1 = pctimer();
for (std::vector<unsigned>::iterator i = items.begin(); i != items.end(); ++i) {
std::cout << *i;
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPreincriment (unsigned): This operation took: " << t2 - t1 << " seconds.\n\n";
// STD::STRING
//
std::cout << "\nSTD::STRING" << std::endl;
std::vector<std::string> string_items;
string_items.push_back("one");
string_items.push_back("two");
string_items.push_back("three");
string_items.push_back("four");
string_items.push_back("five");
string_items.push_back("six");
string_items.push_back("seven");
string_items.push_back("eight");
string_items.push_back("nine");
string_items.push_back("ten");
// Reset the timer.
t1 = pctimer();
for (std::vector<std::string>::iterator i = string_items.begin(); i != string_items.end(); i++) {
std::cout << *i << " ";
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPostincriment (string): This operation took: " << t2 - t1 << " seconds.\n\n";
// Reset the timer.
t1 = pctimer();
for (std::vector<std::string>::iterator i = string_items.begin(); i != string_items.end(); ++i) {
std::cout << *i << " ";
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPreincriment (string): This operation took: " << t2 - t1 << " seconds.\n\n";
// CUSTOM STRING (MSTRING)
//
std::cout << "\nCustom STRING (MSTRING)" << "\n\t - A fast string implementation with a maximum of 8 characters" << std::endl;
std::vector<mstring> mstring_items;
mstring_items.push_back("one");
mstring_items.push_back("two");
mstring_items.push_back("three");
mstring_items.push_back("four");
mstring_items.push_back("five");
mstring_items.push_back("six");
mstring_items.push_back("seven");
mstring_items.push_back("eight");
mstring_items.push_back("nine");
mstring_items.push_back("ten");
// Reset the timer.
t1 = pctimer();
for (std::vector<std::string>::iterator i = string_items.begin(); i != string_items.end(); i++) {
std::cout << *i << " ";
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPostincriment (mstring): This operation took: " << t2 - t1 << " seconds.\n\n";
// Reset the timer.
t1 = pctimer();
for (std::vector<std::string>::iterator i = string_items.begin(); i != string_items.end(); ++i) {
std::cout << *i << " ";
}
std::cout.precision(7);
t2 = pctimer();
std::cout << "\nPreincriment (mstring): This operation took: " << t2 - t1 << " seconds.\n\n";
return 0;
}