boostorg / graph

Boost.org graph module
http://boost.org/libs/graph
325 stars 208 forks source link

Compress boost::property #341

Closed mglisse closed 1 year ago

mglisse commented 1 year ago

Fix #142. It isn't the nicest fix, but it is the smallest one I can think of and someone is free to do better later. Specializing property<*,*,no_property> without m_base would require changing the lookup code that expects this member. Grouping the 2 members in a tuple would also require (syntactic) changes in the rest of the file.

I am not adding a testcase like

#include <boost/static_assert.hpp>
#include <boost/pending/property.hpp>

struct Tag {};
struct Reference { double d; };
typedef boost::property<Tag, Reference> Prop;

int main()
{
  BOOST_STATIC_ASSERT(sizeof(Reference) == sizeof(Prop));
}

because I don't think Boost.Config provides an easy way to detect platforms where BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS does something.

jeremy-murphy commented 1 year ago

We don't have any C++23 builds in our CI at the moment, so you'll have to wait for that to be added via a separate PR.

mglisse commented 1 year ago

We don't have any C++23 builds in our CI at the moment, so you'll have to wait for that to be added via a separate PR.

BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS expands to [[no_unique_address]] for both gcc and clang (except possibly on windows?) even with -std=c++11, and the attribute is not ignored.

jeremy-murphy commented 1 year ago

OK, let's give it a go, thanks!