CPP 1.3 NO IDEA Avatar
  1. OMG Issue

CPP13 — C++ _var type widening proposal

  • Key: CPP13-3
  • Legacy Issue Number: 1418
  • Status: open  
  • Source: Anonymous
  • Summary:

    Summary: Michi Henning & Steve Vinoski have previously challenged people to come
    up with a modification to the C++ language mapping that would allow for
    type safe widening of object reference _var types for assignment or copy
    construction. I believe I have come up with the solution, and Michi
    agrees with me:

    Proposal:

    For object reference _var types, replace the copy and assignment
    operators:

    class T_var

    { public: ... T_var(const T_var &); T_var &operator = (const T_var &); ... }

    ;

    with:

    class T_var {
    public:
    ...
    template <class C_var>
    T_var(const C_var &cv) : ptr_(T::_duplicate(cv.in()) {
    }

    template <class C_var>
    T_var &operator = (const C_var &cv) {
    if ((void *)this != (void *)cv)

    { CORBA::release(ptr_); ptr_ = T::_duplicate(cv.in()); }

    return *this;
    }
    ...
    private:
    T_ptr ptr_;
    };

  • Reported: CPP 1.0b1 — Tue, 2 Jun 1998 04:00 GMT
  • Updated: Fri, 6 Mar 2015 20:57 GMT