views:

71

answers:

1

After some struggling I managed to get boost smart pointers to build for Windows CE/Mobile at warning level 4.

I found the least-resistance-way to get rid of compile errors and warnings to be

#define BOOST_NO_MEMBER_TEMPLATES

What does it actually mean? Did I sell my soul to the devil? Will all hell break loose when I actually use the types?

+3  A: 

There shouldn't be any bad effects per se, just a loss of functionality.

A member template is a member function that is a template, for example:

struct foo
{
    template <typename T>
    void i_am_not_supported_sometimes(void);
};

So you don't get undefined behavior or anything, you just can't program things in a most generic manner. I think a definitive "is this bad" answer depends on exactly what it was being used for and what the work-around was.

Looking at smart_ptr, for example, the no-member-templates version literally just takes out the member templates, such as:

template<class Y>
explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
{
    boost::detail::sp_enable_shared_from_this( this, p, p );
}

And replaces Y with T, so you lose the ability for some automatic conversions.

GMan