Skip to content

Is it possible to join two functors to one? #522

Open
@denzor200

Description

@denzor200

I'm finding something like this:

struct functor_1 {
    void operator() (std::string arg1, std::string arg2)
    {
        std::cout << arg1 << arg2 " from first functor" << std::endl
    }
};
struct functor_2 {
    void operator() (std::string arg1, std::string arg2)
    {
        std::cout << arg1 << arg2 " from second functor" << std::endl
    }
};
join(functor_1(), functor_2())("Hello, ", "World!"); // will print two lines:
// "Hello, World! from first functor"
// .. and
// "Hello, World! from second functor"

Is it possible to do using boost.hana?

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