boostorg / boostorg/hana

boost::hana::drop_front doesn't respect refness

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

Description

```
#include
#include
#include
#include
#include
#include
#include

#include
#include
#include

namespace hana = boost::hana;

int main()
{
int x = 1;
int y = 2;
int z = 3;

std::tuple refs {x, y, z};
auto ref_drop = boost::hana::drop_front(refs);

x = 10;
y = 20;
z = 30;

std::cout << x << " " << y << " " << z << std::endl;
std::cout << std::get<0>(refs) << " " << std::get<1>(refs) << " " << std::get<2>(refs) << std::endl;
std::cout << std::get<0>(ref_drop) << " " << std::get<1>(ref_drop) << std::endl;
}
```
The output of the above code is:
```
10 20 30
10 20 30
2 3
```
Expected output is:
```
10 20 30
10 20 30
20 30
```
I would expect if I pass `boost::hana::drop_front` a `std::tuple` to get back a `std::tuple` but instead I get a `std::tuple`. This is unexpected. Is this intended behavior?

Contributor guide

Open the contributing guide

Research direction

Start by compiling and running the reproducer from the issue, then inspect boost::hana::drop_front and its std::tuple handling. Add a regression test covering std::tuple of references and verify that the dropped tuple preserves the remaining references and produces the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.