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


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

Re: Traits in STL

From Qi <no@no.com>
Newsgroups comp.lang.c++
Subject Re: Traits in STL
Date 2011-07-17 09:47 +0800
Organization Aioe.org NNTP Server
Message-ID <ivtf4o$677$1@speranza.aioe.org> (permalink)
References <04673f16-5afd-47f2-9266-e3f4a00fec6a@fv14g2000vbb.googlegroups.com>

Show all headers | View raw


On 2011-7-17 7:36, Narinder wrote:
>
> You would think (or perhaps not) that the second approach is less
> error prone since it would be less likely that your traits would be
> inconsistent with the char type. The only reason I can think of is
> that you may have a traits class specifically for char which wouldn't
> make sense for any other types and thus wouldn't need to be a
> template. In that case you could always write it as template class and
> use traits to activate it only for char types.

Don't know the real reason.

But IMO, template template parameter is quite less flexible than class.

In your second case, you limit that the traits must be a template with
only one parameter, which is too restrict.

The user may want to provide another char_traits, which first parameter
is charT, second is another accessorial parameter for internal use.


-- 
WQ

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


Thread

Traits in STL Narinder <narinder.claire@gmail.com> - 2011-07-16 16:36 -0700
  Re: Traits in STL Ian Collins <ian-news@hotmail.com> - 2011-07-17 11:46 +1200
    Re: Traits in STL Narinder <narinder.claire@gmail.com> - 2011-07-16 16:54 -0700
      Re: Traits in STL Ian Collins <ian-news@hotmail.com> - 2011-07-17 12:08 +1200
        Re: Traits in STL Narinder <narinder.claire@gmail.com> - 2011-07-16 17:13 -0700
          Re: Traits in STL Ian Collins <ian-news@hotmail.com> - 2011-07-17 14:09 +1200
  Re: Traits in STL Qi <no@no.com> - 2011-07-17 09:47 +0800

csiph-web