Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: String lite...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 23 Topic 9495 of 9830
Post > Topic >>

Re: String literal as template parameter?

by Looney <hardy_melbourne@[EMAIL PROTECTED] > Apr 13, 2008 at 12:45 PM

On Apr 13, 4:09 am, Piotr Rak <piotr....@[EMAIL PROTECTED]
> wrote:
> Hi all,
>
> I was thinking about language feature allowing convert string literal
> into variadic character pack (char...).
>
> Here is real life use case, which comes from Yard parser library
> (http://yard-parser.sourceforge.net/cgi-bin/index.cgi).
> It shall define parser that matches sequence of characters.
> Exact implementation doesn't matter.
>
> It has been slightly modified to use variadic templates
>
> template <char Char1_, char Char2_, char...MoreChars_>
> class CharSeq
> {
>     static const unsigned int length = sizeof...(MoreChars_) + 2;
>
>     inline static char get_nth(unsigned int n);
>
> public:
>     template <typename ParserState_>
>     static bool match(ParserState_& state);
>
> };
>
> typedef CharSeq<'c', 'a', 't', 'c', 'h'> CatchKeyword;
> // which could be:
> //typedef CharSeq<"catch"> CatchKeyword;
>
> There is proposal of 'User-defined literals' (http://www.open-std.org/
> jtc1/sc22/wg21/docs/papers/2007/n2378.pdf), but atleast in my
> understanding, it fails to provide way of doing that.
>
> Is my assumption is correct?
> If yes, what are technical reasons from preventing that?
>
> Cheers, Piotr Rak

the current standard does not sup****t Variadic Templates they may be
added in the c++ox revision
i do not think any c++ compilers other than gcc sup****t this
http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.html
so i fyou do wnat ****table code or are using som other compiler you
would need to declare
your class templates with the required number of template parameters.

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 23 Posts in Topic:
String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-12 12:09:19 
Re: String literal as template parameter?
Looney <hardy_melbourn  2008-04-13 12:45:53 
Re: String literal as template parameter?
Mathias Gaunard <loufo  2008-04-13 18:21:48 
Re: String literal as template parameter?
Brendan <catphive@[EMA  2008-04-13 18:21:13 
Re: String literal as template parameter?
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-13 18:23:27 
Re: String literal as template parameter?
Sean Hunt <rideau3@[EM  2008-04-14 10:43:12 
Re: String literal as template parameter?
mark.zaytsev@[EMAIL PROTE  2008-04-14 13:13:15 
Re: String literal as template parameter?
Mathias Gaunard <loufo  2008-04-14 21:25:44 
Re: String literal as template parameter?
Alberto Ganesh Barbati &l  2008-04-14 21:24:25 
Re: String literal as template parameter?
Alberto Ganesh Barbati &l  2008-04-14 21:24:01 
Re: String literal as template parameter?
Alberto Ganesh Barbati &l  2008-04-14 21:24:40 
Re: String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-15 12:43:13 
Re: String literal as template parameter?
=?ISO-8859-1?Q?Daniel_Kr=  2008-04-15 23:19:28 
Re: String literal as template parameter?
David Peklak <dpeklak@  2008-04-15 23:22:35 
Re: String literal as template parameter?
Alberto Ganesh Barbati &l  2008-04-16 11:43:13 
Re: String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-17 19:35:09 
Re: String literal as template parameter?
Alberto Ganesh Barbati &l  2008-04-18 05:09:08 
Re: String literal as template parameter?
Sean Hunt <rideau3@[EM  2008-04-18 06:13:18 
Re: String literal as template parameter?
Bart van Ingen Schenau &l  2008-04-18 17:19:53 
Re: String literal as template parameter?
gpderetta <gpderetta@[  2008-04-18 17:20:48 
Re: String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-19 01:39:07 
Re: String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-19 02:01:57 
Re: String literal as template parameter?
Piotr Rak <piotr.rak@[  2008-04-19 02:02:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:28:24 CDT 2008.