boostorg / boostorg/hana

Transform the Type in hana::type

Open
#326 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
225
PR merge metrics
No merged PRs in 30d

Description

Consider a convenience function to perform operations modifying the contained type in a `hana::type` without unwrapping it and wrapping it again. Consider the following example:

```cpp
// Current method
decltype(hana::typeid_(hana::back(std::declval()))){};

// More expressive
type_transform(some_tuple_type{}, hana::back);
```

Note: It's important that it strips qualifiers since many functions possibly return references.

Possible Implementation (as discussed in Gitter):
```cpp
template
constexpr auto type_transform(hana::basic_type, F f) {
return decltype(hana::typeid_(f(std::declval()))){};
}
```

Contributor guide

Open the contributing guide

Research direction

Start with hana::basic_type and hana::typeid_, then compare the proposed type_transform signature with the current unwrapping and rewrapping example. Check how returned references and other qualifiers are represented, and define completion as a convenience operation that applies the callable to the contained type while stripping qualifiers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.