Boost logo

Boost :

Subject: Re: [boost] Curiousity question
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2016-10-12 21:29:56


On 12.10.2016 21:19, Edward Diener wrote:
> On 10/12/2016 8:40 PM, Stefan Seefeld wrote:
>> On 12.10.2016 20:20, Edward Diener wrote:
>>> On 10/12/2016 7:17 PM, Stefan Seefeld wrote:
>>>> At this point in time (with GCC 6.2 as my default compiler in my
>>>> development environment), I'd use std::shared_ptr, and fall back to
>>>> boost::shared_ptr for environments without C++11 support.
>>>
>>> How would you fall back to support boost::shared_ptr ?
>>
>> With something as simple as:
>>
>> #if __cplusplus >= 201103L
>> // use std::shared_ptr
>> ...
>> #else
>> // use boost::shared_ptr
>> ...
>> #endif
>>
>
> Wouldn't you need to duplicate the above every time you are using
> shared pointers ?

That depends on the granularity of the conditional block (something
between conditionalizing a single token and including an entire header).
What works best depends on the specific context.

In Boost.Python there aren't that many places in need of
conditionalizing. Most code is so generic it doesn't even know or care
whether it's passing shared pointers around.

    Stefan

-- 
      ...ich hab' noch einen Koffer in Berlin...

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk