c++ - Access to different struct with same name -
i'm trying implement workaround boost versions cause problems scoped enums on linking in c++11 mode: see https://svn.boost.org/trac/boost/ticket/6779 , https://svn.boost.org/trac/boost/ticket/10038
the problem simply: pre-distributed boost libs expose (namespaces stripped):
detail::copy_file(path const&, path const&, copy_option::enum_type, error_code*)
c++11 compilation tries find:
detail::copy_file(path const&, path const&, copy_option, error_code*)
due fact, c++98 boost uses emulated scoped enums, instead of c++11 ones.
i though might able write adapter put own object file , link program, failed naive approach:
#define copy_option native_copy_option__ #include <boost/filesystem/operations.hpp> #undef copy_option namespace boost { namespace filesystem { struct copy_option{ enum enum_type{none, fail_if_exists = none, overwrite_if_exists}; }; namespace detail { void copy_file(const path& from, const path& to, copy_option::enum_type option, system::error_code* ec=0); using copy_option = native_copy_option__; void copy_file(const path& from, const path& to, copy_option option, system::error_code* ec) { copy_file(from, to, static_cast<boost::filesystem::copy_option::enum_type>(option), ec); } } // namespace detail } // namespace filesystem } // namespace boost
the problem is: need define function c++11 enum in signature declare function c++98 enum has same name.
is somehow possible?
i think should write portable code.
conditionally compiling "competing" variants of code solicits odr violations , spurious abi incompatibility issues.
Comments
Post a Comment