Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2006-09-27 18:24:58


Bugs item #1566672, was opened at 2006-09-27 16:24
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1566672&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: JoeyX (zxing)
Assigned to: Nobody/Anonymous (nobody)
Summary: The ptr_map iterator cannot be dereference to value type

Initial Comment:
The following code was built and worded well under
VS.NET 2003 and boost v1.33. But under boost v1.34, it
cannot built

// testshareptr.cpp : Defines the entry point for the
console application.
//

#include "stdafx.h"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\ptr_container\ptr_map.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\ptr_container\ptr_vector.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\signal.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\signals\slot.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\signals\trackable.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\signals\connection.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\visit_each.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\last_value.hpp"
#include "C:\Dev\Head\Third Party Libraries\Public
Headers\boost\lambda\algorithm.hpp"
#include <algorithm>
#include <functional>

class TValue
{
private:
        int m_n;

public:

        TValue(int n = 0)
        {
                m_n = n;
                printf("I am brith at %i\n", m_n);
        }

        ~TValue()
        {
                printf("I am %i and dying\n", m_n);
        }

        void WhoIs()
        {
                printf("I am %i\n", m_n);
        }

        int Get(void) const {return m_n;}
        int Get2(void) {return m_n;}
};

typedef boost::ptr_map<int, TValue>CMyMap;

bool Larger(const TValue& p1, const TValue& p2)
{
        bool bRet = false;

        bRet = (p2.Get() <= p1.Get() && (p2.Get()%2==0));

        return bRet;
}

void TestCase1()
{
        printf("\n\n======================TestCase
1:======================\n");
        CMyMap mymap;
        for(int i = 0; i < 10; ++i)
        {
                mymap.insert(i, new TValue(i));
        }

        std::stable_sort(mymap.begin(), mymap.end(), Larger);
}

int _tmain(int argc, _TCHAR* argv[])
{
        TestCase1();
        return 0;
}

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1566672&group_id=7586

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk