Compile-time 'String' Manipulation with Variadic Templates

后端 未结 2 1291
忘掉有多难
忘掉有多难 2020-12-30 10:04

Hey all, I\'m currently trying to write a compile-time string encryption (using the words \'string\' and \'encryption\' quite loosely) lib.

What I have so far is as

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 10:47

    If I understand what you want to do correctly (actually create an array at compile time) I think variadic templates aren't enough and you'll have to wait for constexpr.

    If however you don't need an actual array and can instead compromise on using something akin to tuple's get then it's possible (you can then build a char array at runtime).

提交回复
热议问题