boostorg / boostorg/hana

Runtime support for searchables

Open
#456 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

This doesn't compile

#include
#include
#include

bool f() {
auto t = std::make_tuple(boost::optional{boost::none}, boost::optional{4});
return boost::hana::all(t);
}

This does, but not under MSVC (it rightfully complains that the lambda passed to `all_of` needs to return a `Logical`.

#include
#include
#include

bool f() {
auto t = std::make_tuple(boost::optional{boost::none}, boost::optional{4});
return boost::hana::all_of(t, [](auto v) { return static_cast(v); });
}

This compiles everywhere, but is suboptimal due to lack of early return:

#include
#include
#include

bool f() {
auto t = std::make_tuple(boost::optional{boost::none}, boost::optional{4});
return boost::hana::fold(t, true, [](bool state, auto v) {
return state && static_cast(v);
});
}

Reading through the documentation, I couldn't find any information about runtime support of algorithms. Is this a bug or an expected limitation?

Contributor guide

Open the contributing guide

Research direction

Start with the boost::hana::all and boost::hana::all_of entry points using the supplied std::tuple and boost::optional examples. Read the runtime-algorithm documentation referenced in the issue and compare behavior across MSVC and other compilers. Done means the intended runtime support or limitation is established and documented with a consistent outcome for the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
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.