is possible make string template parameter , how? like
a<"okay"> type.
any string (std::string or c-string) fine.
yes, need put in variable external linkage (or c++11 remove requirement external linkage). basically, given:
template <char const* str> class { /* ... */ };
this:
extern char const okay[] = "okay"; a<okay> ...
works. note thought not contents of string define uniqueness, object itself:
extern char const okay1[] = "okay"; extern char const okay2[] = "okay";
given this, a<okay1>
, a<okay2>
have different types.
Comments
Post a Comment