Skip to content

Use concepts guards - #82

Merged
petlenz merged 2 commits into
mainfrom
use-concepts-guards
Feb 24, 2026
Merged

Use concepts guards#82
petlenz merged 2 commits into
mainfrom
use-concepts-guards

Conversation

@petlenz

@petlenz petlenz commented Feb 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Define tensor_expr_holder and tensor_to_scalar_expr_holder concepts, mirroring the existing scalar_expr_holder
  • Move scalar_expr_holder from scalar_std.h to scalar_expression.h so it's available earlier in the include chain
  • Replace all bare template <typename> and enable_if_t SFINAE in tensor and tensor_to_scalar function templates with concept constraints
  • All 596 tests pass unchanged — purely compile-time constraint tightening with no behavioral change

Files changed

  • scalar_expression.h / scalar_std.h — moved concept definition
  • tensor_expression.h — added tensor_expr_holder
  • tensor_to_scalar_expression.h — added tensor_to_scalar_expr_holder
  • tensor_functions.h — constrained 15 templates (dev, sym, vol, skew, inner_product, otimes, otimesu, otimesl, permute_indices, trans, inv)
  • tensor_std.h — constrained 2 pow overloads
  • tensor_to_scalar_std.h — constrained 7 templates (pow ×4, log, exp, sqrt)

@petlenz petlenz self-assigned this Feb 24, 2026
@petlenz
petlenz merged commit 124860e into main Feb 24, 2026
22 checks passed
@petlenz
petlenz deleted the use-concepts-guards branch February 24, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant