Boost logo

Boost Users :

From: Zeljko Vrba (zvrba_at_[hidden])
Date: 2007-06-04 12:30:54


On Mon, Jun 04, 2007 at 05:10:31PM +0200, Ion Gaztañaga wrote:
>
> Since I don't have access to a SunCC compiler you will need to help me
> discover how SunCC implements pointer to data members. I will need for
>
It's downloadable for free, both for Linux and Solaris :)

>
> example the size of a pointer to data member (a simple
> sizeof(ptr_to_member) would be enough), and what the binary value of of
> that pointer to member for different layouts, say:
>
The program at the bottom prints the following for NN=10 and NN=20:

4 45
4 85

Do you need more information?

==
#include <iostream>
#include <boost/intrusive/list.hpp>
                                                                                                                                                                                              
struct klass {
    void *data_[NN];
    char ch_;
    boost::intrusive::list_member_hook<> hook_;
    typedef boost::intrusive::list<
        boost::intrusive::list_member_hook<>::value_traits<
            klass, &klass::hook_>,
        false> list;
};
                                                                                                                                                                                              
int main(void)
{
    using std::cout;
    using std::endl;
    boost::intrusive::list_member_hook<> klass::*ptr = &klass::hook_;
    cout << sizeof(ptr) << ' ' << *(size_t*)&ptr << endl;
    return 0;
}
==


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