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

boost::hof::construct to support aggregates #221

Open
Aster89 opened this issue Nov 17, 2021 · 0 comments
Open

boost::hof::construct to support aggregates #221

Aster89 opened this issue Nov 17, 2021 · 0 comments

Comments

@Aster89
Copy link

Aster89 commented Nov 17, 2021

I've discovered BOOST_HOF_LIFT/BOOST_HOF_LIFT_CLASS some time ago, and it's very useful when I want to make an object out of the name of a templated and/or overloaded function.

Then I've discovered boost::hof::construct, which helps me avoid writing [](auto x){ return Ctor{x}; } all over the place.

But almost immediately I run into the issue that boost::hof::construct can't be used with aggregate types (sorry if I'm misusing the term, I mean those that don't have a user defined constructor; if I understand this, that's what an aggregate is, but correct me if I'm wrong).

I know that HigherOrderFunctions is a header-only C++11/C++14 library, but the point is that using class names as object is not possible in those standards, but not even in C++17, or C++20, for what is worth, so BOOST_HOF_LIFT/BOOST_HOF_LIFT_CLASS/boost::hof::construct are still all useful in those newer standards.

So my bottom line is, why not upgrading boost::hof::construct so that it can work with aggregate types too (in C++17, where std::is_aggregate) is available?

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