OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [cxx/] [ustl/] [current/] [tests/] [bvt11.cpp] - Blame information for rev 819

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
// This file is part of the uSTL library, an STL implementation.
2
//
3
// Copyright (c) 2005-2009 by Mike Sharov <msharov@users.sourceforge.net>
4
// This file is free software, distributed under the MIT License.
5
 
6
#include "stdtest.h"
7
 
8
void PrintVector (const int* first, const int* last)
9
{
10
    cout << "{";
11
    while (first < last)
12
        cout << ' ' << *first++;
13
    cout << " }" << endl;
14
}
15
 
16
void TestSetAndMultiset (void)
17
{
18
    const int vv[] = { 1, 8, 9, 2, 3, 1, 1, 4, 6, 1, 3, 4 };
19
    set<int> v (VectorRange (vv));
20
    multiset<int> mv (VectorRange (vv));
21
    cout << "set:\t\t";
22
    PrintVector (v.begin(), v.end());
23
    cout << "erase(3):\t";
24
    v.erase (3);
25
    PrintVector (v.begin(), v.end());
26
    cout << "multiset:\t";
27
    PrintVector (mv.begin(), mv.end());
28
    cout << "count(1) = " << mv.count(1) << endl;
29
    cout << "find(4) = " << lower_bound (mv, 4) - mv.begin() << endl;
30
    cout << "find(5) = " << binary_search (mv, 5) << endl;
31
    cout << "erase(3):\t";
32
    mv.erase (3);
33
    PrintVector (mv.begin(), mv.end());
34
}
35
 
36
StdBvtMain (TestSetAndMultiset)

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.