attributes are on the way

This commit is contained in:
Marc Wäckerlin
2009-08-31 11:28:33 +00:00
parent b5643a87a2
commit 481ae4ed8d
2 changed files with 48 additions and 27 deletions

View File

@@ -2,7 +2,20 @@
#include <cryptoki.hxx>
#include <iostream>
template <int NUM, typename TYPE> std::vector<TYPE> toVector(TYPE in[NUM]) {
return std::vector<TYPE>(in, in+NUM);
}
#define VECTOR(ARRAY) toVector<sizeof(ARRAY)/sizeof(ARRAY[0])>(ARRAY)
template <typename Array> void print(const std::vector<Array>& v) {
for (typename std::vector<Array>::const_iterator it(v.begin()); it!=v.end(); ++it)
std::cout<<"Item: "<<*it<<std::endl;
}
int main(int argc, char const*const*const argv) try {
//std::vector<int> v(toVector<4>((int[]){1,2,3,4}));
std::vector<int> v(VECTOR(((int[]){1,2,3,4})));
print(v);
cryptoki::Init init(argc==2?argv[1]:"onepin-opensc-pkcs11.so");
cryptoki::Info inf(init.info());
std::cout<<"##################### INFO #####################"<<std::endl