|
Boost Users : |
Subject: Re: [Boost-users] compile-time string literal manipulation?
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2010-10-28 04:08:59
2010/10/28 Ovanes Markarian <om_boost_at_[hidden]>
>
>
> On Thu, Oct 28, 2010 at 1:41 AM, Eric Niebler <eric_at_[hidden]> wrote:
>
>>
>> You might find the interface less than ideal. C++ doesn't allow strings
>> as template parameters.
>>
>> --
>> Eric Niebler
>> BoostPro Computing
>> http://www.boostpro.com
>
>
> Hi Eric,
>
> just a question: It is possible to pass array objects with external linkage
> as template parameters, is there any way one can manipulate them at compile
> time? I am wondering, if one can pass begin and end iterator as template
> parameters and verify such a string. That might have real impact on compile
> time...
>
> If I can use such a function:
> tempalte<size_t N>
> void array_len(char (&arr)[])
> {}
>
> I might be able to pass instantiated function template function to the
> template to calculate the string length and than I have begin and length of
> the string, and can apply recusion at compile time. What do you think about
> it?
>
You can access the pointer at compile time but not the characters. So you
indeed can have 'begin' and 'length', but accessing the content at compile
time is still impossible.
Roman Perepelitsa.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net