El 03/07/2023 a las 14:01, Andy Bell via Boost-users escribió:

Hi

 

I’m using the type erasure library but have an issue (which I can workaround) when compiling in Windows 10 using Embarcadero C++ Builder 11.3.

 

My problem is that C++ Builder brings in the Windows SDK Windows.h include file in every Windows VCL UI project it creates *before* any of my code has compiled and it’s causing conflicts in boost header member11.hpp.

 

This code is enough to cause the error:

 

#include <boost/type_erasure/any.hpp>

#include <boost/type_erasure/any_cast.hpp>

#include <boost/type_erasure/builtin.hpp>

#include <boost/type_erasure/operators.hpp>

#include <boost/type_erasure/member.hpp>

#include <boost/type_erasure/free.hpp>

#include <boost/mpl/vector.hpp>

 

namespace mynamespace {

BOOST_TYPE_ERASURE_MEMBER(ReadStatus)

}

 

The error is because Windows.h defines ‘interface’ but this code from member11.hpp also uses ‘interface’:

 

template<class P, template<class ...> class interface, class Sig, class Concept, class Base, class ID>
using choose_member_interface = typename ::boost::mpl::if_c< ::boost::is_reference<P>::value,
    typename ::boost::mpl::if_c< ::boost::type_erasure::detail::is_non_const_ref<P>::value,
        interface<Sig, Concept, Base, const ID>,
        Base
    >::type,
    interface<Sig, Concept, Base, ID>
>::type;

 

and the compiler complains of conflicts.

 

Hi Andy,

The solution you propose (renaming "interface" as "interface_") looks perfectly fine to me,
as template parameter names are not externally visible. In any case, would you mind filing an
issue at https://github.com/boostorg/type_erasure/issues ? I may see that it's addressed.

Best,

Joaquín M López Muñoz