Boost logo

Boost :

Subject: [boost] Fwd: [Math/Statistical Distributions] Help on using distributions' global accessors
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-06-07 02:48:24

Hi all,

I've decided to "cross-post" the message below to boost devel mailing
list in the hope someone can answer to my questions.

Sorry for the duplicate


-- Marco

---------- Forwarded message ----------
From: Marco Guazzone <marco.guazzone_at_[hidden]>
Date: Thu, Jun 4, 2009 at 3:40 PM
Subject: [Math/Statistical Distributions] Help on using distributions'
global accessors
To: boost-users_at_[hidden]

Dear Boost users,

I don't understand why the code in the attached file
"" does not work. :(

It compiles without problems, but as I run it I get the following
error as soon as the *variance* accessor is called:

--- [error] ---
Running 2 test cases...
unknown location(0): fatal error in "exponential_distribution": memory
access violation at address: 0x7fffa6254ff8: no mapping at fault
test.cpp(34): last checkpoint

*** 1 failure detected in test suite "test::stats test suite"
--- [/error] ---

I've also tried to replace the use of inheritance with the removal of
class "exponential_distribution" and directly injecting inside my
namespace the Boost one, that is:
namespace test { namespace stats {
 using ::boost::math::exponential_distribution;
 using ::boost::math::exponential;
but without success.

Instead, the error *disappear* if I use the code in
"", where instead of using inheritance and
"injection" I use membeship (i.e., composition). Why?

My compiler is GCC 4.3.2 and my system is Fedora 10 x86_64.

If you want to try the attached code you can simply type 'make' from
your shell (provided you have a unix like system) and then run the
command "./test".

A note about the code: you may ask yourself why I'm redefining some
functions already defined by the Boost library.
The reason lies in the fact that my final goal is to create a wrapping
library in order to change without pain the underlying real

An help or a hint would be very very very appreciated!! :)

Thank you very much!

-- Marco

Boost list run by bdawes at, gregod at, cpdaniel at, john at