Beispiel #1
0
// Inserting and extracting arrays from a container T of type U
template <class T> void sequence_test(type_id tid, const many<typename T::value_type>& values) {
    T x(values.begin(), values.end());

    value vx(x);                // construt
    ASSERT_EQUAL(tid, vx.type());
    ASSERT_EQUAL(x, get<T>(vx));

    value v2;                   // assign
    v2 = x;
    ASSERT_EQUAL(tid, v2.type());
    ASSERT_EQUAL(x, get<T>(v2));
    ASSERT_EQUAL(vx, v2);

    T y(x);
    *y.begin() = *(++y.begin()); // Second element is bigger so y is lexicographically bigger than x
    value vy(y);
    ASSERT(vx != vy);
    ASSERT(vx < vy);
    ASSERT(vy > vx);
}
Beispiel #2
0
template <class T, class S> bool operator==(const S& s, const many<T>& m) {
    return S(m.begin(), m.end()) == s;
}
Beispiel #3
0
template <class T, class S> bool operator==(const many<T>& m, const S& s) {
    return m.size() == s.size() && S(m.begin(), m.end()) == s;
}