Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-Index] View contents of multi-index with debugger
From: elizabeta petreska (elizabeta.petreska_at_[hidden])
Date: 2010-12-27 07:59:48


Hi,
I copied the necessary code to C:\Program Files\Microsoft Visual Studio
8\Common7\Packages\Debugger\autoexp.dat, and tried the following example
which is posted in the archives
http://lists.boost.org/boost-users/2007/06/28394.php , but it doesnot work
like the given sreenshot in the example. The information that is shown in
the watch windows is the same as before.

#define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE 5
#define BOOST_MULTI_INDEX_LIMIT_TAG_SIZE 3
#define BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE 5
#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>
#include <boost/multi_index/random_access_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;
    }
    bool operator==(test const& other) const {
        return x==other.x;
    }
};
namespace boost {
    inline std::size_t hash_value(test const& t)
    {
        return hash_value(t.x);
    }
}

typedef multi_index_container<test,
indexed_by<hashed_non_unique<identity<test> > > > cont;

VISUALIZE_MULTI_INDEX_CONTAINER(cont);

int main() {
    cont test_cont;
    test_cont.insert(test(L"aaa"));
    test_cont.insert(test(L"aaa", L"other"));
    test_cont.insert(test(L"aac"));
    return 0; // see screenshoxt
}

On Mon, Dec 27, 2010 at 11:26 AM, Igor R <boost.lists_at_[hidden]> wrote:

> > I started using multi-index container, everything works fine, but I have
> > hard time when debugging my code with Visual Studio 2005.
> > The problem is I can't see the contents of the container when point my
> mouse
> > to the container variable i.e I am seeing bunch of information that needs
> to
> > be expanded, but can't see the actual elements in the container, for
> example
> > like I can with std::vector.
> > Is there some way to do this ? thanks
>
> You can try using the appropriate Visualizer:
>
> https://svn.boost.org/svn/boost/sandbox/boost_docs/subprojects/DebuggerVisualizers/
>
> IIRC, using visuzlizer for MI-container requires some additional code as
> well.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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