When I write C++ code, I try to use a using <X>
to keep from polluting too much. In Crypto++, it gives me problem in one case. The case is the ASN1 namespace within the CryptoPP namespace (it only shows up in one place).
Here's the declaration in Crypto++: http://www.cryptopp.com/docs/ref/oids_8h_source.html.
I can use, for example, secp256r1
curve with:
CryptoPP::ASN1::secp256r1();
However, I have not figured out a way to declare it with using. When I try:
#include <cryptopp/asn.h>
#include <cryptopp/oids.h>
using CryptoPP::ASN1;
It eventually leads to error: namespace ‘CryptoPP::ASN1’ not allowed in using-declaration
, and then error: ‘ASN1’ has not been declared
at the following (I tried them both):
ECIES<ECP>::Decryptor d1(prng, secp256r1());
ECIES<ECP>::Decryptor d2(prng, ASN1::secp256r1());
How does one use a using
statement when there is more than one namespace?
$ g++ -version
i686-apple-darwin11-llvm-g++-4.2
Just say:
using namespace CryptoPP::ASN1;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With