Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uuid::repr_type is inaccessible #170

Open
tobias-loew opened this issue Nov 11, 2024 · 4 comments
Open

uuid::repr_type is inaccessible #170

tobias-loew opened this issue Nov 11, 2024 · 4 comments

Comments

@tobias-loew
Copy link

The new internal data_type has the two public operators

        BOOST_CXX14_CONSTEXPR operator repr_type& () noexcept { return repr_; }
        constexpr operator repr_type const& () const noexcept { return repr_; }

but their return type repr_type is private and therefore inaccessible from outside.
As the operators are not used internally, I assume, they're to be used be users, so repr_type should also be public.

@pdimov
Copy link
Member

pdimov commented Nov 11, 2024

repr_type is just an alias for std::uint8_t[16]. It's not intended to be named.

@tobias-loew
Copy link
Author

Ok. But calling the user-defined conversion would then always require a typedef, since conversion-type-id does not allow array-brackets (https://en.cppreference.com/w/cpp/language/cast_operator).
IMHO, it would be nice also having functions (e.g. as_array()) returning a [const] reference to repr_.

@pdimov
Copy link
Member

pdimov commented Nov 11, 2024

The conversion to repr_type& is an implementation detail, only intended to support old code that used data as a data member. So if you're using it to obtain access to the underlying array, it might indeed be better to provide a documented way to do that.

Out of curiosity, for what would you use this function?

@tobias-loew
Copy link
Author

I've got a template-based serialization-library (not Boost.Serialization), which works out-of-the box, when it can deduce the full array-information (type and size). It used to work with code like ar & uuid_variable.data using Boost 1.85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants