|
Boost Users : |
Subject: Re: [Boost-users] [Pool] Use singleton_pool in struct
From: Claude (clros_at_[hidden])
Date: 2012-10-12 03:45:30
Ok, now it work well, thanks!
But..I have another problem. In this code (C++11 with std::tuple)
#include <iostream>
#include <map>
#include <tuple>
#include <boost/pool/pool_alloc.hpp>
using namespace std;
struct data
{
int a,b;
char name[50];
std::map<std::string,std::tuple<uint16_t,uint16_t>> myComplexType;
};
struct myStruct
{
struct MyOrderTag {};
typedef boost::singleton_pool<MyOrderTag,sizeof(data)> poolMemory;
};
int main()
{
data *d = (data*)myStruct::poolMemory::malloc();
d->a = 8;
strcpy(d->name,"Hello!");
//fill myComplexType field (this row causes a segfault!)
d->myComplexType["one"] = std::tuple<uint16_t,uint16_t>(1,2);
myStruct::poolMemory::release_memory();
return 0;
}
I obtain a segmentation fault error when assign a tuple at myComplexType
field. What is wrong?
-- View this message in context: http://boost.2283326.n4.nabble.com/Pool-Use-singleton-pool-in-struct-tp4636741p4637005.html Sent from the Boost - Users mailing list archive at Nabble.com.
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