cpp-proposals-pub icon indicating copy to clipboard operation
cpp-proposals-pub copied to clipboard

LayoutMapping requirements should constrain `is_always_*()` to be `constexpr`

Open dhollman opened this issue 6 years ago • 1 comments

This is because the primary use case is for constraining algorithms. For instance, the following should be prohibited:

extern bool foo;
struct _my_mapping {
  /* ... */
  static bool is_always_contiguous() { return foo; }
};

I think the way we should do this is to say in the table that the expression that needs to be valid is std::bool_constant<M::is_always_contiguous()>{}

dhollman avatar Aug 12 '19 22:08 dhollman

Agreed.

crtrott avatar Aug 12 '19 22:08 crtrott