Advertisement
WeltEnSTurm

Untitled

Jan 21st, 2012
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1.  
  2. template <typename T, T... Chars>
  3. class EncryptString {
  4.     private:
  5.  
  6.         static std::size_t const Length = sizeof...(Chars);
  7.         T* Value;
  8.         std::size_t Current;
  9.  
  10.         template<typename... T_args>
  11.         void AddChar(T c, T_args... others){
  12.             AddChar((((c ^ 0x12) ^ 0x55) + 1));
  13.             AddChar(others...);
  14.         }
  15.  
  16.         void AddChar(T c){
  17.             Value[Current++] = c;
  18.         }
  19.  
  20.     public:
  21.  
  22.         EncryptString(){
  23.             Current = 0;
  24.             Value = new T[Length + 1];
  25.             AddChar(Chars...);
  26.         }
  27.  
  28.         ~EncryptString(){
  29.             delete[] Value;
  30.         }
  31. };
  32.  
  33.  
  34. EncryptString<char, 'T','e','s','t','i','n','g'> str;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement