Re: Clang does not like constexpression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This isn't a drop-in replacement for strlen(). It works differently
for strings with \0 buried somewhere in the middle.

Regards,
Radek

On Wed, Jun 14, 2017 at 7:16 PM, Michal Jarzabek <stiopa@xxxxxxxxx> wrote:
> You could also do :
>
> template< size_t N >
> constexpr size_t string_length(const char (&)[N] )
> {
>   return N-1;
> }
>
>
> On Wed, Jun 14, 2017 at 5:50 PM, Jesse Williamson <jwilliamson@xxxxxxx> wrote:
>>
>>
>> Here's a C++11 version that might be useful to you (largely untested,
>> and I'm only on my first cup of coffee, so... ;>).
>>
>> -Jesse
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux