Boost logo

Boost Users :

Subject: Re: [Boost-users] Using C++ class with namespace in C
From: Richard Damon (Richard_at_[hidden])
Date: 2013-04-23 21:09:22


On 4/16/13 5:04 AM, Somostetoi Kilato wrote:
> Hi,
>
> maybe it is not the best place to ask but at this moment I have no
> other idea where to go. This question is just a preamble for all
> the comming, BOOST related, questions of mine.
>
> So, I have a C++ class, the Apple, at the moment in the std namespace:
> ...
> My question is, if I want to move my Apple class in a custom
> namespace, garden, how must I modify my C header and code file?
>
> Thank you and all the best,
> Kilato Somostetoi
>
>
Since your C file only deals with the structure via pointers to void,
moving the class into a name space will have no effect.

Note, that the functions you are declaring to return/take pointers to
void, really do return/take pointers to void, and the functions do the
casting to Apple* inside.

The thing to note is that by definition, a pointer to ANY type/object
can be converted to a pointer to void and back to its original type and
it will point to the same object.

-- 
Richard Damon


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