Computer Science Canada

advcmp.h - Advanced Comparisons of lists and vectors

Author:  wtd [ Fri Feb 13, 2004 10:21 pm ]
Post subject:  advcmp.h - Advanced Comparisons of lists and vectors

The attached library works like so:

code:
#include <iostream>
#include <list>
#include <vector>
#include "advcmp.h"

int main()
{
    using namespace advcmp;
    using namespace std;

    list<int> l;
    l.push_back(1);
    l.push_back(1);
    l.push_back(1);

    vector<int> j;
    j.push_back(1);
    j.push_back(2);

    int a[] = { 0, 1, 2, 3, 4 };

    if (all<int>(l) != all<int>(j) && all<int>(l) == one<int>(5, a))
        cout << "hello" << endl;
    else
        cout << "world" << endl;
}


Oh yeah, and the astute will notice that it works with arrays too. Smile

Note: trying to get in and hack the file directly may result in brain damage. It is 1451 lines long.


: