Skip to content

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

Description

@KierenP
#include <boost/hana/ext/std/tuple.hpp>
#include <boost/hana/fold_left.hpp>
#include <boost/hana/find_if.hpp>
#include <boost/hana/for_each.hpp>
#include <boost/hana/transform.hpp>
#include <boost/hana/tuple.hpp>
#include <boost/hana/type.hpp>

#include <iostream>
#include <tuple>
#include <vector>

namespace hana = boost::hana;

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

    std::tuple<int&, int&, int&> 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<T&, U&, V&> to get back a std::tuple<U&, V&> but instead I get a std::tuple<U, V>. This is unexpected. Is this intended behavior?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions