News for hackers. Stuff that matters.
Re:Deprecating Raw Pointers in C++20 by mbel on Sunday April 01, 2018 @06:24AM (#16727618)
It seems to be a joke, they would have serious problem with backward compatibility with "this" pointer. Also it would limit the use cases for the language, unless they would introduce something like std::raw_ptr, which to be honest would be quite funny.
Re:Deprecating Raw Pointers in C++20 by evincarofautumn on Sunday April 01, 2018 @09:47AM (#16728225)
Honestly this wouldn’t be a bad idea for consistency, teaching, and template programming purposes:

    namespace std {
        template<typename T>
        using raw_ptr = T*;
    }

    // mutable pointer to const value
    int const *a_old;
    std::raw_ptr<int const> a_new;
    std::raw_ptr<const int> a_new_var;

    // const pointer to mutable value
    int *const b_old;
    std::raw_ptr<int> const b_new;
    const std::raw_ptr<int> b_new_var;

    // const pointer to const value
    int const *const c_old;
    std::raw_ptr<int const> const c_new;
    const std::raw_ptr<const int> c_new_var;
I’ve actually used this before to parameterise a struct/class with an ownership policy, for example:

    template<template<typename T, typename...> class P>
    struct Wrapper {
        P<int> value;
    };
Now Wrapper<std::raw_ptr> is a non-owning Wrapper, while Wrapper<std::unique_ptr> is an owning one.