Unified adapter utilities for type-safe and zero-cost adaptation.
This header provides a unified adapter system:
- adapter<T>: Generic wrapper for values and smart pointers
- adapter_traits<T>: Type traits for adapter configuration
- interface_adapter<I, Impl>: Interface adaptation with depth tracking
- adapter_factory: Factory for creating zero-cost adapters
Usage:
auto val = make_adapter<int>(42);
auto shared = make_shared_adapter<MyClass>(args...);
auto executor = make_interface_adapter<IExecutor>(thread_pool);
auto pool = unwrap_adapter<thread_pool_type>(executor);
if (executor->get_wrapper_depth() > 1) {
}
Migration Guide:
- make_smart_adapter<I>(impl) -> make_interface_adapter<I>(impl)
- smart_adapter_factory::make_adapter -> adapter_factory::create
Definition in file adapters.h.