Boost logo

Boost :

Subject: Re: [boost] C++03 / C++11 compatibility question for compiled libraries
From: Peter Dimov (lists_at_[hidden])
Date: 2018-02-08 23:36:32


degski wrote:

> > Assuming a non-header-only library for the sake of going back onto the
> > topic, this would create exactly the problems we've been discussing, if
> > you link your C++17 code to the C++14-built library, or vice versa. For
> > what gainz?
>
> I'm probably missing the point. If that C++17 (exe-code) and C++14
> (library-code) are built with the same compiler (an unavoidable C++
> problem, C is great in some sense!), unless the C++17 code is in the
> header, why would it cause problems?

Because if you have

class X
{
private:

    beast::string_view sv_;

public:

    // ...
};

the class layout and size could change if you compile this in two
translation units, one C++14 (uses boost::string_view), one C++17 (uses
std::string_view).

Same with optional.


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