C++ Logo

std-proposals

Advanced search

Re: The new new thing

From: Matt Hurd <matthurd_at_[hidden]>
Date: Fri, 21 Feb 2020 23:16:12 +1100
>
> see my "PSSST" (Peter's simple strong typing) framework attempt (not
> finished) at
>
>
> https://github.com/PeterSommerlad/Psst/blob/master/cevelop-workspace/PssstTest/src/pssst.h
>
> achievable through a library, so no need to change. In addition it allows
> you to clearly limit the available operations to a set suitable for your
> domain specific type. For usage see accompanying test cases.
>
Thanks Peter. That's a nice approach.

PSSST has similar goals to another couple of libs I've used for safety and
strong typing of numerics. However, I'm thinking about a more fundamental
thing of cloning a type without it being seen as the same type by the
compiler's type system.

I'm also wondering if such a thing may be useful for also extending things,
such as tuples, optional, vector, variant without the potential pitfalls of
inheritance. Though different composability customisation points would be
useful in such situations (pre, post, invariant, in, out, dot operator,
etc). C# has extension methods and we have difficulties without the
promising C++3a reflection/rewriting. Unfortunately C++ may fail to
optimise properly across abi boundaries for simple composed types which can
be frustrating (the infamous unique_ptr example). Performance concerns
makes my own simple wrapper types feel a queasy as I'd like to get out of
the optimiser's way as much as possible.

Kind regards,

--Matt.

Received on 2020-02-21 06:19:10