• Cpp-Core-Guidelines
  • Introduction
  • 1. Preface
  • 2. Abstract
  • 3. In: Introduction
  • 4. P: Philosophy
  • 5. I: Interfaces
  • 6. F: Functions
  • 7. C: Classes and Class Hierarchies
    • 7.1. C.ctor: Constructors, assignments, and destructors
    • 7.2. C.con: Containers and other resource handles
    • 7.3. C.over: Overloading and overloaded operators
  • 8. Enum: Enumerations
  • 9. R: Resource management
  • 10. ES: Expressions and Statements
  • 11. PER: Performance
  • 12. CP: Concurrency Programming
    • 12.1. CP.con: Concurrency
    • 12.2. CP.free: Lock-free programming
    • 12.3. CP.par: Parallelism
    • 12.4. CP.simd: SIMD
  • 13. E: Error handling
  • 14. Con: Constants and Immutability
  • 15. T: Templates and generic programming
    • 15.1. T.gp: Generic programming
    • 15.2. T.temp-hier: Template and hierarchy rules
    • 15.3. T.concepts: Concept rules
      • 15.3.1. T.concepts.def: Concept definition rules
      • 15.3.2. T.con-use: Concept use
    • 15.4. T.interfaces: Template interfaces
    • 15.5. T.def: Template definitions
    • 15.6. T.meta: Template metaprogramming (TMP)
  • 16. CPL: C-style programming
  • 17. SF: Source files
  • 18. SL: The Standard Library
    • 18.1. SL.c: The C Standard Library
    • 18.2. SL.regex: Regex
    • 18.3. SL.con: Containers
    • 18.4. SL.str: String
    • 18.5. SL.io: Iostream
  • 19. A: Architectural Ideas
  • 20. RF: References
    • 20.1. RF.rules: Coding rules
    • 20.2. RF.books: Books with coding guidelines
    • 20.3. RF.C++: C++ Programming (C++11/C++14)
    • 20.4. RF.web: Websites
    • 20.5. RF.video: Videos about "modern C++"
    • 20.6. RF.man: Manuals
  • 21. Profiles
  • 22. Type safety profile
  • 23. GSL: Guideline support library
    • 23.1. GSL.concept: Concepts
    • 23.2. GSL.util: Utilities
    • 23.3. GSL.assert: Assertions
    • 23.4. GSL.owner: Ownership pointers
    • 23.5. GSL.view: Views
    • 23.6. GSL.smartptr: Smart pointer concepts
  • 24. NL: Naming and layout rule
  • 25. FAQ: Answers to frequently asked questions
  • 26. Appendix
    • 26.1. Appendix A: Libraries
    • 26.2. Appendix B: Modernizing code
    • 26.3. Appendix C: Discussion
  • 27. Glossary
  • 28. Bibliography
  • 29. Acknowledgements
Powered by GitBook

Cpp-Core-Guidelines

T.concepts: Concept rules

Concepts is a facility for specifying requirements for template arguments. It is an ISO technical specification, but not yet supported by currently shipping compilers. Concepts are, however, crucial in the thinking about generic programming and the basis of much work on future C++ libraries (standard and other).

Concept use rule summary:

  • T.10: Specify concepts for all template arguments
  • T.11: Whenever possible use standard concepts
  • T.12: Prefer concept names over auto
  • T.13: Prefer the shorthand notation for simple, single-type argument concepts
  • ???

Concept definition rule summary:

  • T.20: Avoid "concepts" without meaningful semantics
  • T.21: Define concepts to define complete sets of operations
  • T.22: Specify axioms for concepts
  • T.23: Differentiate a refined concept from its more general case by adding new use patterns
  • T.24: Use tag classes or traits to differentiate concepts that differ only in semantics
  • T.25: Avoid negating constraints
  • T.26: Prefer to define concepts in terms of use-patterns rather than simple syntax
  • ???