Is there a way to combine what’s going to be output by static_assert? What I mean is this:
template<class T>
struct X
{
static_assert(std::is_signed<T>::value, "Type " + T + " must be signed.");//this doesn't work
};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On the basis that this does not compile
nor this
Both with errors
error: expected a string literalthen I would have to conclude that it is not possible.“A string literal consists of zero or more characters from the source character set surrounded by double quotation marks (“). A string literal represents a sequence of characters that, taken together, form a null-terminated string.” – C++ String Literals
You might want to consider using
Boost::StaticAssertas this might give you what you are looking for.