boostorg / boostorg/hof

boost::hof::construct to support aggregates

Open
#221 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
509
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I've discovered `BOOST_HOF_LIFT`/`BOOST_HOF_LIFT_CLASS` [some time ago](https://stackoverflow.com/a/68357266/5825294), 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](https://stackoverflow.com/questions/69993346/does-boost-or-another-library-offer-a-way-to-lift-the-name-of-a-constructor-l) (sorry if I'm misusing the term, I mean those that don't have a user defined constructor; if I understand [this](https://stackoverflow.com/a/4178176/5825294), 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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the boost::hof::construct entry point and review how it currently creates objects, along with the existing C++11/C++14 compatibility constraints. Define support for aggregate types in C++17 while preserving behavior for non-aggregate types and older standards; add or update coverage for the aggregate case before verifying the library tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.