I am trying to port some feature from my password manager into c++ , but however I would like if its way to port this line of python to c++ equivalent. I wish to implement at least close to this 2 lines of code to c++
t = string.ascii_lowercase + string.ascii_uppercase + string.digits + string.punctuation
key = ''.join([secrets.choice(t) for _ in range(20)])
#include "common.h"
#include <iostream>
std::string Common::ascii_lowercase() {
std::string ascii_lowercase;
for (char c = 97; c <= 122; c++)
ascii_lowercase += c;
return ascii_lowercase;
}
std::string Common::ascii_uppercase() {
std::string result;
for (char c = 65; c <= 90; c++)
result += c;
return result;
}
std::string Common::digits(){
std::string digits;
for (int i = 0; i <= 9; i++) {
digits += std::to_string(i);
}
return digits;
}
std::string Common::punctuation() {
std::string punctuation;
for (int i = 33; i <= 47; i++)
punctuation += i;
for (int j = 58; j <= 64; j++)
punctuation += j;
for (int z = 91; z <= 96; z++)
punctuation += z;
return punctuation;
}