Open irwir opened 1 year ago
Test the code with:
CXXFLAGS="-std=c++03" make -j 4
These flags are for GCC? I do not have it installed and almost always use Visual Studio, where currently the lowest possible seems to be /std:c++14
C++03 standards do not include emplace
; it might be implemented but this could not be relied on.
This replacement could be done with a simple macro possibly named as CRYPTOPP_EMPLACE_BACK
.
The definition may depend on CRYPTOPP_CXX11
, or it could be a special CRYPTOPP_EMPLACE
flag if necessary.
// emplace_front and emplace_back have been defined in C++11
ifndef CRYPTOPP_CXX11_EMPLACE
define CRYPTOPP_CXX11_EMPLACE 1
endif
The idea is to add this definition into config_cxx.h
at the end of CRYPTOPP_CXX11
block, and
after the CRYPTOPP_CXX11
block add CRYPTOPP_EMPLACE_BACK
macro that expands to emplace_back
or push_back
method calls.
Is this good enough for a PR?
emplace_*
methods are more efficient when adding new objects, but might require C++11. Does it make sense to add code for this? Tests run successfully for the branch https://github.com/irwir/cryptopp/tree/use_emplace