Arithmetic in C++ Using Counting Pointers
summary
Claims a complete integer system built from stacked pointers in C++ type space that avoids built-in integers, runtime code, and `constexpr`. It implements increment/decrement via pointer add/remove, addition by shifting pointers across operands, multiplication with a recursive template accumulator helper, and exponentiation by repeated multiplication; tests use decltype-based checks and verify results up to small examples like 2+2=4 and 2^3=8. It is header-only and zero-cost for small N but intentionally overwhelms compilers for larger values as a stress test.
AI-written summary · about
chapters (9)
- 0:00Introduction to Pointer Arithmetic
- 0:27Counting Pointers as Numbers
- 1:04Type-Safe Arithmetic Without Integers
- 1:33Implementing Increment and Decrement
- 2:00Addition in Type Space
- 2:43Multiplication with Templates
- 3:45Exponentiation with Recursive Templates
- 4:46Why Use Compile-Time Arithmetic?
- 5:03Final Thoughts and Compiler Stress Testing
related talks
29mintegral types
51mThe C++ Type System is your Friend
01h 08mFrom Numerical Cosmology to Efficient Bit Abstractions for the Standard Library
22mThe Point Challenge - Returning Different Types for the Same Operation
01h 01mBack to Basics: Pointers and Memory
12mCompile-Time Counter Using Template & Constexpr Magic
51mC++ Features You Might Not Know
01h 02mFancy Pointers for Fun and Profit
