C++ Logo

std-proposals

Advanced search

A Generic Library for Lifetime Extension and In-place Construction

From: Mingxin Wang <mingxwa_at_[hidden]>
Date: Sat, 4 May 2019 12:48:55 +0000
Hi folks,

I would like to propose a generic library for lifetime extension and in-place construction.

When designing template libraries, I found it difficult to extend the lifetime of an argument without copy/move construction or type conversion, especially when a function template accepts multiple arguments with different semantics. The proposed library is a solution for template library API design, enabling them to have elegant APIs while making it easy to extend the lifetime of arguments with potentially lower overhead even if they are not convertible from any other type or not move constructible themselves.

I think this library has the potential for simplifying the API of several facilities in the standard. Meanwhile, it was already used in the API of PFA [P0957] and the concurrent invocation library [P0642].

Please find the draft of the proposal here: https://raw.githubusercontent.com/wmx16835/my-stl/9f9ac848401c2dfa3ee8c1211603ee2266d73e94/doc/extended_preview.pdf
... and corresponding implementation here: https://github.com/wmx16835/my-stl/blob/f39acd63ca251ae82608962aaf33b7f1f9f88122/src/main/common/more_utility.h#L113-L317

I am looking forward to your valuable comments.

Thanks,
Mingxin Wang

Received on 2019-05-04 07:51:24