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


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

Re: Is this valid c++?

From Richard Damon <news.x.richarddamon@xoxy.net>
Newsgroups comp.lang.c++
Subject Re: Is this valid c++?
Date 2011-11-09 10:47 -0500
Organization A noiseless patient Spider
Message-ID <j9e79n$qlb$1@dont-email.me> (permalink)
References <d42e7802-cfd7-475f-88c5-b2b81b0e9c12@g27g2000pre.googlegroups.com>

Show all headers | View raw


On 11/9/11 10:29 AM, dec4106 wrote:
> Earlier today I came across a code example that looked something like
> this:
>
>
> template<typename T, unsigned S>
> class MyClass
> {
> public:
>      MyClass() = default;
>      ...
>
> "default" is not defined anywhere in the example.  I've never seen an
> expression like this before and don't understand how it could work,
> and haven't been able to make it work.  Is this a C++11 thing?
>

Yes, that is a new C++11 construct, it tells the compiler to make a 
standard default constructor MyClass() with the "default" 
implementation, even if some other constructor is defined that would 
suppress the generation of the default constructor.

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


Thread

Is this valid c++? dec4106 <dec4106@gmail.com> - 2011-11-09 07:29 -0800
  Re: Is this valid c++? Richard Damon <news.x.richarddamon@xoxy.net> - 2011-11-09 10:47 -0500
    Re: Is this valid c++? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-09 17:48 +0000
      Re: Is this valid c++? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-09 14:04 -0500
        Re: Is this valid c++? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-10 20:20 +0000
          Re: Is this valid c++? Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-10 16:36 -0500
            Re: Is this valid c++? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-11-12 08:29 +0000
  Re: Is this valid c++? Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2011-11-09 16:55 +0100
    Re: Is this valid c++? Krice <paulkp@mbnet.fi> - 2011-11-09 23:12 -0800
      Re: Is this valid c++? Juha Nieminen <nospam@thanks.invalid> - 2011-11-10 07:53 +0000
  Re: Is this valid c++? Daryle Walker <darylew@gmail.com> - 2011-11-13 02:26 -0800

csiph-web