You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include<alps/params.hpp>using alps::params;
using std::string;
///Some function that requires a C stringvoidconsume_c_str(constchar*) {}
intmain(int argc, char**argv) {
params p(argc,argv);
p.define<string>("str", "default", "A string param");
// Attempt to pass a parameter as a C-stringconsume_c_str(p["str"]); // Throws!// Attempt to obtain a C string:constchar* my_c_str=p["str"]; // Throws!
}
throws type_mismatch exception about illegal attempted conversion from string to char*.
This looks like a bug: either it should perform the conversion and return a const char* pointer to the underlying string (whether it's a good idea is a different question), or it should fail at compile time, as it does with other unsupported types.
The text was updated successfully, but these errors were encountered:
The following code:
throws
type_mismatch
exception about illegal attempted conversion fromstring
tochar*
.This looks like a bug: either it should perform the conversion and return a
const char*
pointer to the underlying string (whether it's a good idea is a different question), or it should fail at compile time, as it does with other unsupported types.The text was updated successfully, but these errors were encountered: