Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
D
dune-grid
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 46
    • Issues 46
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 20
    • Merge Requests 20
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Core Modules
  • dune-grid
  • Issues
  • #28

Closed
Open
Opened Oct 17, 2016 by Martin Nolte@martin.nolteMaintainer

Strange signatures for IndexSet and IdSet methods taking an entity

IndexSet and IdSet have implement (nearly) all methods taking an entity twice, e.g.,

Index index ( const Entity &entity ) const
{
  return index< Entity::codimension >( entity );
}

template< int cc >
Index index ( const typename GridImp::template Codim< cc >::Entity &entity ) const
{
  return asImp().index< cc >( entity );
}

The implementation then only implements the method index< cc >. This has the downside, that the implementation has to use IndexSet::index to provide the first version, if not casted down to the interface.

As far as I know, the purpose of this technique is to ensure the type Entity coinsides with typename GridImp::template Codim< cc >::Entity. Today, this could also be done by an SFINAE:

template< class Entity , std::enable_if_t< std::is_same< Entity, typename GridImp::template Codim< Entity::codimension >::Entity >::value, int > = 0 >
Index index ( const Entity &entity ) const
{
  asImp().index( entity );
}

This way, the interface would still protect the method index from being called with a wrong entity type.

I propose to use the SFINAE version, here. However, this will break implementations, unless we use another SFINAE trick to detect the implementation (and use proper deprecation).

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: core/dune-grid#28