C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] The new new thing
From: Peter Sommerlad (C++) (peter.cpp_at_[hidden])
Date: 2020-02-21 04:22:12


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.
>
>
>
>
>
>
>



STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups