Skip to content

Support for arbitrary range types #66

Closed
@Manu343726

Description

@Manu343726

first of all, tag this as "feature-request" "discussion" etc, for the first time I'm not coming here with a bug report :P

I've been thinking about reflecting any kind of iterable range type. By range I mean any type where calls to std::begin() and std::end() are valid.

I see two advantages of implementing that interface:

  • Out of the box support for any container: As long as you're doing a foreach loop (which is the case in most of the template loops) it works. Of course we could provide a fake size() method that does std::distance(), for the uncommon case an user applies a length filter on the range.

  • Lazy ranges: This could be a game changer. By accepting arbitrary range types users could pass lazy ranges to the template, which means true zero-copy API binding. In my case, with @foonathan's cppast, a coroutine range implementing the AST visit comes to my mind.

Metadata

Metadata

Assignees

Labels

die hardDifficult to fix/implement bug or featureenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions