Programming Challenge 11
Description
Write a version of assert, which takes an even number of parameters with
the following structure:
assert(message1, condition1, message2, condition2, ..., messageN, conditionN)
This version will not terminate on a condition failing and only report the
messages for the conditions that fail. Write a version of this function in C and
a version of this function in C++. Name the function
variadic_assert
. Place the C version in a namespace c
and the C++ version in a namespace cpp
. Finally, write a test to
ensure that your methods work as you expect.
Details
- Name the files and program
test_variadic_assert.cpp
and
variadic_assert.h
.
- In your top file comment, describe two advantages of C++ variadic
templates.