Skip to content

[FR]: Make Combine generating custom types (CombineTo) #4728

Open
@Stoorx

Description

@Stoorx

Does the feature exist in the most recent commit?

I did not find that functionality.

Why do we need this feature?

It would be more handy to write:

struct MyStruct {
  int a;
  std::string b;
};

ParamGenerator<MyStruct> gen = CombineTo<MyStruct>(Values(1, 2, 3), Values("a", "b", "c"));

Than:

struct MyStruct {
  int a;
  std::string b;

  using TupleT = std::tuple<int, std::string>;

  MyStruct(const TupleT& t): a(std::get<0>(t)), b(std::get<1>(t)) {}
};

ParamGenerator<MyStruct> gen = ConvertGenerator<MyStruct::TupleT>(Combine(Values(1, 2, 3), Values("a", "b", "c")));

Describe the proposal.

Actually I have already developed it. #4727

In two words: I have introduced a new function CombineTo and refactored CartesianProductGenerator to support custom types instantiation.

Maybe it is better to rename to CombineAs.

Is the feature specific to an operating system, compiler, or build system version?

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions