|
Boost Users : |
Subject: Re: [Boost-users] Mersenne twister problem
From: ruya (rmlopes_at_[hidden])
Date: 2009-09-15 04:50:41
SearchFunctor has a virtual destructor, the derivees have empty destructor.
MemHandler is just a helper does not store anything.
class SearchFunctor{
protected:
typedef SmartPtr<SType> SPtr;
typedef typename SType::Domain Domain;
typedef typename SType::DPtr DPtr;
typedef typename Domain::MType MType;
typedef typename Domain::MPtr MPtr;
typedef typename Domain::EPtr EPtr;
typedef typename Domain::RPtr RPtr;
typedef vector<typename SType::MPtr> MVector;
typedef typename SType::DataType DataType;
typedef boost::mt19937 base_generator_type;
typedef boost::variate_generator<base_generator_type&,
boost::uniform_real<> > GeneratorI;
typedef Private<MemP::ObjectType::_ACTIVE,MemP> MemHandler;
public:
virtual SPtr operator()( SPtr s, int iter ) = 0;
SearchFunctor(){
memh = MemHandler();
generator1 = base_generator_type(MASTER_SEED+13);
uni_dist1 = boost::uniform_real<>(0,1);
uniEmp = new GeneratorI(generator1, uni_dist1);
generator2 = base_generator_type(MASTER_SEED+17);
uni_dist2 = boost::uniform_real<>(0,1);
uniRes = new GeneratorI(generator2, uni_dist2);
}
protected:
virtual ~SearchFunctor(){}
base_generator_type generator1, generator2;
boost::uniform_real<> uni_dist1, uni_dist2;
GeneratorI* uniEmp;
GeneratorI* uniRes;
MemHandler memh;
};
Matthias Troyer-2 wrote:
>
>
> On Sep 14, 2009, at 9:40 AM, ruya wrote:
>
>>
>> Hi
>>
>>
>> Matthias Troyer-2 wrote:
>>>
>>> I would write this very differently, and can give you a better
>>> version
>>> that should have no problems, but could you please send me the
>>> definition of GeneratorI first?
>>>
>> Sorry about that, the missing typedefs at SearchFunctor:
>>
>> typedef boost::mt19937 base_generator_type;
>> typedef boost::variate_generator<base_generator_type&,
>> boost::uniform_real<> > GeneratorI;
>
>
> Another question: what does the destructor of your class look like?
> Can you send the full class?
>
> Matthias
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
-- View this message in context: http://www.nabble.com/Mersenne-twister-problem-tp25382114p25450374.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