Concept-Based Generic Programming in C++
- URL: http://arxiv.org/abs/2510.08969v1
- Date: Thu, 09 Oct 2025 15:27:30 GMT
- Title: Concept-Based Generic Programming in C++
- Abstract summary: Concepts are C++'s way to express constraints on generic code.<n>As an initial example, we provide a simple type system that eliminates narrowing conversions.<n> Concepts are used throughout to provide user-defined extensions to the type system.
- Score: 0.0
- License: http://creativecommons.org/licenses/by-nc-sa/4.0/
- Abstract: We present programming techniques to illustrate the facilities and principles of C++ generic programming using concepts. Concepts are C++'s way to express constraints on generic code. As an initial example, we provide a simple type system that eliminates narrowing conversions and provides range checking without unnecessary notational or run-time overheads. Concepts are used throughout to provide user-defined extensions to the type system. The aim is to show their utility and the fundamental ideas behind them, rather than to provide a detailed or complete explanation of C++'s language support for generic programming or the extensive support provided by the standard library. Generic programming is an integral part of C++, rather than an isolated sub-language. In particular, key facilities support general programming as well as generic programming (e.g., uniform notation for types, lambdas, variadic templates, and C++26 static reflection). Finally, we give design rationales and origins for key parts of the concept design, including use patterns, the relationship to Object-Oriented Programming, value arguments, notation, concept type-matching, and definition checking.
Related papers
- Action Language BC+ [3.677571687801579]
Action languages are formal models of parts of natural language that describe effects of actions.<n>We propose a new action language called BC+, which closes the gap between action languages and the modern ASP language.
arXiv Detail & Related papers (2025-06-22T14:09:49Z) - ClassInvGen: Class Invariant Synthesis using Large Language Models [11.374431160444676]
ClassInvGen is a method for co-generating executable class invariants and test inputs.<n>We show that ClassInvGen outperforms a pure LLM-based technique to generate specifications (from code)<n>We also demonstrate its applicability to real-world code by performing a case study on several classes within a widely used and high-integrity C++.
arXiv Detail & Related papers (2025-02-26T08:10:57Z) - Order-Sorted Intensional Logic: Expressing Subtyping Polymorphism with Typing Assertions and Quantification over Concepts [1.104960878651584]
Subtyping, also known as subtype polymorphism, is a concept extensively studied in programming language theory.<n>In this paper, we explore the capability of order-sorted logic for utilizing these ideas in the context of Knowledge Representation.
arXiv Detail & Related papers (2025-02-13T11:51:22Z) - Compositional Program Generation for Few-Shot Systematic Generalization [59.57656559816271]
This study on a neuro-symbolic architecture called the Compositional Program Generator (CPG)
CPG has three key features: textitmodularity, textitcomposition, and textitabstraction, in the form of grammar rules.
It perfect achieves generalization on both the SCAN and COGS benchmarks using just 14 examples for SCAN and 22 examples for COGS.
arXiv Detail & Related papers (2023-09-28T14:33:20Z) - Outline, Then Details: Syntactically Guided Coarse-To-Fine Code
Generation [61.50286000143233]
ChainCoder is a program synthesis language model that generates Python code progressively.
A tailored transformer architecture is leveraged to jointly encode the natural language descriptions and syntactically aligned I/O data samples.
arXiv Detail & Related papers (2023-04-28T01:47:09Z) - Benchmarking Language Models for Code Syntax Understanding [79.11525961219591]
Pre-trained language models have demonstrated impressive performance in both natural language processing and program understanding.
In this work, we perform the first thorough benchmarking of the state-of-the-art pre-trained models for identifying the syntactic structures of programs.
Our findings point out key limitations of existing pre-training methods for programming languages, and suggest the importance of modeling code syntactic structures.
arXiv Detail & Related papers (2022-10-26T04:47:18Z) - Object-Oriented Requirements: a Unified Framework for Specifications,
Scenarios and Tests [63.37657467996478]
Article shows that the concept of class is general enough to describe not only "objects" in a narrow sense but also scenarios such as use cases and user stories.
Having a single framework opens the way to requirements that enjoy the benefits of both approaches.
arXiv Detail & Related papers (2022-09-06T02:47:20Z) - Representation and Synthesis of C++ Programs for Generalized Planning [2.752817022620644]
The paper introduces a novel representation for Generalized Planning (GP) problems, and their solutions, as C++ programs.
Our C++ representation allows to formally proving the termination of generalized plans, and to specifying their complexity w.r.t.
Characterizing the complexity of C++ generalized plans enables the application of a search that enumerates the space of possible GP solutions in order of complexity.
arXiv Detail & Related papers (2022-06-29T09:13:21Z) - OrdinalCLIP: Learning Rank Prompts for Language-Guided Ordinal
Regression [94.28253749970534]
We propose to learn the rank concepts from the rich semantic CLIP latent space.
OrdinalCLIP consists of learnable context tokens and learnable rank embeddings.
Experimental results show that our paradigm achieves competitive performance in general ordinal regression tasks.
arXiv Detail & Related papers (2022-06-06T03:54:53Z) - Identifying concept libraries from language about object structure [56.83719358616503]
We leverage natural language descriptions for a diverse set of 2K procedurally generated objects to identify the parts people use.
We formalize our problem as search over a space of program libraries that contain different part concepts.
By combining naturalistic language at scale with structured program representations, we discover a fundamental information-theoretic tradeoff governing the part concepts people name.
arXiv Detail & Related papers (2022-05-11T17:49:25Z) - Hierarchical Poset Decoding for Compositional Generalization in Language [52.13611501363484]
We formalize human language understanding as a structured prediction task where the output is a partially ordered set (poset)
Current encoder-decoder architectures do not take the poset structure of semantics into account properly.
We propose a novel hierarchical poset decoding paradigm for compositional generalization in language.
arXiv Detail & Related papers (2020-10-15T14:34:26Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.