Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #71618

Re: Template alias destructor call

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c++
Subject Re: Template alias destructor call
Date 2020-01-27 01:40 -0800
Organization A noiseless patient Spider
Message-ID <86zhe9grv3.fsf@linuxsc.com> (permalink)
References <r09o3o$a96$1@dont-email.me> <r0bsc1$jsa$1@dont-email.me> <r0busk$24i$1@dont-email.me>

Show all headers | View raw


Paavo Helde <myfirstname@osa.pri.ee> writes:

> [problems with x->~B<T>().]
>
> Thanks!  The typedef workaround indeed seems to work:
>
> template <typename T>
> void foo(B<T>* x) {
>     typedef B<T> B_t;
>     x->~B_t();
> }

Alternatively,

    template <typename T>
    void foo(B<T>* x) {
        using B_t = B<T>;
        x->~B_t();
    }

Don't take this as a complaint, it is simply an unabashed plug
for choosing 'using' over 'typedef' (my own personal preference).

Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Template alias destructor call Paavo Helde <myfirstname@osa.pri.ee> - 2020-01-22 17:01 +0200
  Re: Template alias destructor call "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2020-01-23 11:26 +0100
    Re: Template alias destructor call Paavo Helde <myfirstname@osa.pri.ee> - 2020-01-23 13:09 +0200
      Re: Template alias destructor call Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-27 01:40 -0800

csiph-web