Announcing beman.indirect

I’m happy to announce that beman.indirect is now available. It implements std::indirect and std::polymorphic as proposed in https://wg21.link/P3019R14 — vocabulary types for composite class design that provide value semantics for owned heap-allocated objects.

What’s in the library

  • indirect<T>: Owns a heap-allocated T with deep-copy semantics and const-propagation.
  • polymorphic<T>: Owns a heap-allocated object derived from T with polymorphic deep-copy via type erasure.

The library supports C++17 through C++26 across GCC, Clang, AppleClang, and MSVC. C++20 features (concepts, <=>, constexpr destructors, [[no_unique_address]]) are used when available, with SFINAE and explicit operator fallbacks for C++17. The C++17 port adds some complexity, but we have a use case for it in that environment and I think the trade-off is worth it.

The AI experiment

This was an experiment using Claude code to do the bulk of the implementation work. The result, I think, speaks for itself — it’s a complete, tested, CI-passing implementation. The total token cost was about $40, and the whole effort took roughly half a day.

That said, this was not a case of “press a button and walk away.” I needed to carefully monitor what Claude was doing throughout and frequently prompt it with my C++ expertise — knowledge of the standard, Beman conventions like [CPP.NO_FLAG_FORKING], and judgment calls about the right approach. It wouldn’t have worked without that.

Broader implications

I think we should have a broader conversation about how AI tooling will impact the Beman project. The fact that a complete library implementation — including C++17 compatibility, CI, tests, and examples — could be done in about half a day is notable. If I get a few spare moments, I’ll write up a more detailed experience report.

Feedback and contributions welcome!