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

Conversion of non-copyable Struct to tuple #452

Open
sdebionne opened this issue Jul 9, 2019 · 0 comments
Open

Conversion of non-copyable Struct to tuple #452

sdebionne opened this issue Jul 9, 2019 · 0 comments

Comments

@sdebionne
Copy link
Contributor

sdebionne commented Jul 9, 2019

I have the following use case that converts a non-copyable Struct to tuple:

#include <string>
#include <boost/hana.hpp>

struct person {
    person (person const&) = delete;

    std::string name;
    unsigned short age;
};

BOOST_HANA_ADAPT_STRUCT(person , name, age);

int main()
{
    auto t = boost::hana::to_tuple(std::declval<person>());
    return 0;
}

that fails to compile with the following error:

boost/hana/detail/ebo.hpp:73:40: error: use of deleted function 'person::person(const person&)'
             : data_(static_cast<T&&>(t))

Since I did not see any restriction in the documentation regarding copyability, I wonder if this is expected and/or could be worked around?

@sdebionne sdebionne changed the title Conversion of non-copiable Struct to tuple Conversion of non-copyable Struct to tuple Jul 9, 2019
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

1 participant