TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
C++ Coding Standard

Rule:  STY#018Checked automatically with code checker

This rule is Obsolete
Synopsis:The keyword typename shall be used to introduce a type parameter to a template
Severity Level:9


A type parameter to a template can be introduced using either class or typename keyword. The latter is preferred, because the type does not necessarily have to be a class type, and the class keyword can therefor be confusing in this context.



<	typename ExceptionType		// type of exception thrown
,	typename AssertionType		// type of assertion expression
inline void
(	AssertionType	assertion	// this assertion will be checked
,	ExceptionType	exception	// this exception may be thrown

// DESCRIPTION		: Template function to check an arbitrary assertion
//	and to throw an appropriate exception if the check fails.
// POSTCONDITIONS	: Assertion checked.
// EXCEPTIONS		: A user supplied object of ExceptionType is thrown
//	when the assertion fails.
// NOTES		: Calling this function, instead of writing out the
//	conditional throw statement directly, makes explicit that this
//	is an assertion of something that is supposed to be always true
//	and therefor not an ordinary part of the program logic.
//	See section of "The C++ programming language, 3rd ed"
//	(Stroustrup) for more information on assert macro alternative.
//	Example:
//		BB_IB_MOD_Assert(
//			(CHECK_PRECONDITIONS && (item_ptr != nullptr)),
//			std::invalid_argument("item_ptr"));
	if (!assertion)
		throw exception;