C++ Logo

std-proposals

Advanced search

Re: The new new thing

From: Peter Sommerlad (C++) <"Peter>
Date: Fri, 21 Feb 2020 11:22:12 +0100
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.

Regards
Peter.
Matt Hurd via Std-Proposals wrote on 21.02.20 01:21:
> using my_typedifferent_int_t = int64_t is a little disappointing. No
> type safety by design which is excellent mostly.
>
> How about:
>
> using new qty_t = int64_t;
> using new px_t = int64_t;
>
>
> auto bid = qty_t{100};
>
> auto ask = px_t{200};
>
> auto err0 = bid + ask; // does not compute
>
>
> & extensions without inheritance for reuse?
>
>
> template<typename T>
>
> struct bah_humbug_vector2 : new std::vector<T>{
>
>
> constexpr auto ssize() const noexcept ->
> std::make_signed_t<decltype(size())>{
>
> assert( size() <= std::numeric_limits<size_type>::max );
>
> return static_cast<std::make_signed_t<decltype(size())>>(size());
>
> }
>
> };
>
>
> It would simplify a lot of my life and bring some facilities to C++
> other languages support.
>
>
> < $0.02
>
>
> --Matt.
>
>
>
>
>
>
>


Received on 2020-02-21 04:24:56