Skip to content

Allow CPO edges(g, u) to be also customized by u.edges() #175

@akrzemi1

Description

@akrzemi1

Currently, CPO edges(g, u) is considered valid when (among other options) u.edges(g) is valid. But consider this implementation of a graph:

namespace MyLibrary 
{
  struct MyEdge {
    string content;
    int indexOfTarget;
  };

  struct MyVertex {
    string content;
    vector<MyEdge> outEdges;
  };

  class MyGraphA {
    std::vector<MyVertex> _vertices;
  };

  class MyGraphB {
    std::vector<MyVertex> _vertices;
  };
}

At the point of defining my class MyVertex I do not know the type of the graph that will be holding me. In fact, more than one graph type may be storing the same vertex type. If MyVertex were to define the member funciton edges, I do not know what graph type to pass it. And on the other hand, MyVertex::edges does not need the graph type for anything. I can of course make MyVertex::edges a template, but why forcing me to declare templates?

Alternatively, extend the customization point edges(g, u) so that it is valid when wither u.edges(g) is valid or u.edges() is valid.

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