Hi Claude,
Since the first usage compiles fine I guess "malloc" is a static method of boost::singleton_pool
Try changing your call to
myStruct::poolMemory::malloc


Regards,
koval

2012/10/8 Claude <clros@tiscali.it>
Hi!
I have a problem with singleton_pool when I use it into a struct.
I think that this problem is my bad knowledge of C++ and not a problem of
boost pool.

#include <iostream>
#include <boost/pool/pool_alloc.hpp>

using namespace std;

struct data
{
    int a,b;
    char name[50];
};


struct MyOrderTag {};
typedef boost::singleton_pool<MyOrderTag,sizeof(data)> poolMemory;


struct myStruct
{
     struct MyOrderTag {};
     typedef boost::singleton_pool<MyOrderTag,sizeof(data)> poolMemory;
};


int main()
{
    data *d = (data*)poolMemory::malloc(); //This is ok

    myStruct ms;
  //  data *d1 = (data*)ms.poolMemory::malloc(); //Error!

    d->a = 2;


    poolMemory::release_memory();
    return 0;
}

I obtain a compiler error on row:
data *d1 = (data*)ms.poolMemory::malloc();
The poolMemory in struct is only a typedef and not a struct field.
How can I use a singleton_pool into a struct?







--
View this message in context: http://boost.2283326.n4.nabble.com/Pool-Use-singleton-pool-in-struct-tp4636741.html
Sent from the Boost - Users mailing list archive at Nabble.com.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users