[cvs] / jsr166 / src / test / CppDemo.cpp Repository:
ViewVC logotype

View of /jsr166/src/test/CppDemo.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (annotate)
Sat Dec 13 20:45:42 2003 UTC (9 years, 5 months ago) by tim
Branch: MAIN
CVS Tags: JSR166_PFD
Add C++/JNI demo targets as first step to possible use of JNI in
1.4-usable version of j.u.c. Still probably highly Windows-specific,
but at least it uses gcc, so there is hope.
#include <iostream>
#include <map>

using namespace std;


int main (int argc, const char* const* argv) {
    map<string, int> m;
    for (int i = 1; i < argc; ++i) {
        string word(argv[i]);
        ++m[word];
    }
    // map is really a sorted map, so this prints words in
    // lexicographic order.
    for (map<string, int>::const_iterator it = m.begin(); it != m.end(); ++it) {
        cout << it->second << " " << it->first << "\n";
    }
}

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8