Tomáš Šalamon wrote:
As I add the last line with the list, I get: "Error 1 error C2248:
'boost::intrusive::list_impl<Config>::list_impl' : cannot access private
member declared in class 'boost::intrusive::list_impl<Config>'
c:\program files\boost\boost_1_35_0\boost\intrusive\list.hpp 1434".
Is there any problem with recursion in Boost intrusive containers?
I don't think so. This works for Visual 2005 and gcc-4.3:
#include
#include
#include <string>
using namespace boost::intrusive;
struct pageTag;
typedef link_mode NormalLinkMode;
typedef set_base_hook SetPageHook;
typedef list_base_hook ListPageHook;
class Page :
public ListPageHook,
public SetPageHook
{
public:
typedef set PageSet;
typedef list PageList;
Page(){}
friend bool operator< (const Page &a, const Page &b)
{ return a.fullPath < b.fullPath; }
friend bool operator> (const Page &a, const Page &b)
{ return a.fullPath > b.fullPath; }
friend bool operator== (const Page &a, const Page &b)
{ return a.fullPath < b.fullPath; }
void add_to_pagelist(Page &p)
{
links.push_back(p);
}
private:
// some stuff here
PageList links; //THIS IS THE PROBLEM ??
std::string fullPath;
};
int main()
{
Page parent_page, child_page;
parent_page.add_to_pagelist(child_page);
return 0;
}
Thank you.
Tomas
Regards,
Ion