Opened 16 years ago
Last modified 15 years ago
#730 closed Bugs (wontfix)
The ptr_map iterator cannot be dereference to value type — at Initial Version
Reported by: | zxing | Owned by: | Thorsten Ottosen |
---|---|---|---|
Milestone: | Component: | ptr_container | |
Version: | None | Severity: | Problem |
Keywords: | Cc: |
Description
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; }
Note:
See TracTickets
for help on using tickets.