C++ Logo

std-proposals

Advanced search

The new new thing

From: Matt Hurd <matthurd_at_[hidden]>
Date: Fri, 21 Feb 2020 11:21:40 +1100
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-20 18:24:38