Boost logo

Boost Users :

From: Filip Konvička (filip.konvicka_at_[hidden])
Date: 2007-05-31 04:44:15


Sorry, I posted the wrong test2.cpp, here is the correct one.

F.


#include "mic_visualizer.hpp"

#include <string>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/ordered_index.hpp>
using namespace boost::multi_index;
using std::wstring;
using namespace std;

struct test {
  wstring x;
  wstring y;
  test(wchar_t const *str, wchar_t const *str2=L"def") : x(str), y(str2) {}
  bool operator<(test const& other) const {
    return x<other.x;
  }
};

typedef multi_index_container<test, indexed_by<sequenced<>, ordered_unique<identity<test> > > > cont;

VISUALIZE_MULTI_INDEX_CONTAINER(cont);

int wmain() {
  cont test_cont;
  test_cont.push_back(test(L"aaa"));
  test_cont.push_back(test(L"bbb"));
  test_cont.push_back(test(L"ccc", L"ddd"));
  return 0; // see screenshot
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net