Skip to content

Commit ca58d78

Browse files
committed
add assert_always() without print
1 parent 0817e68 commit ca58d78

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/utki/debug.hpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ namespace utki {
193193
* If the condition is false, it will print the assertion failure message along with the information string
194194
* provided by the passed in function and then abort the program.
195195
* @param condition - condition to check for being true.
196-
* @param print - fucntion providing information string to print in case the assertion fails.
196+
* @param print - function providing information string to print in case the assertion fails.
197197
* @param source_location - location of the assert() invocation in the source code.
198198
*/
199199
void assert_always(
@@ -205,12 +205,35 @@ void assert_always(
205205
#endif
206206
);
207207

208+
/**
209+
* @brief Assert that condion is true.
210+
* If the condition is true, then nothing happens.
211+
* If the condition is false, it will print the assertion failure message along with the information string
212+
* provided by the passed in function and then abort the program.
213+
* @param condition - condition to check for being true.
214+
* @param source_location - location of the assert() invocation in the source code.
215+
*/
216+
inline void assert_always(
217+
bool condition,
218+
const utki::source_location& source_location
219+
#if CFG_CPP >= 20
220+
= std_source_location::current()
221+
#endif
222+
)
223+
{
224+
assert_always(
225+
condition, //
226+
nullptr,
227+
source_location
228+
);
229+
}
230+
208231
/**
209232
* @brief Assert that condion is true.
210233
* In debug build this function invokes assert_always().
211234
* In non-debug build this fuction does nothing.
212235
* @param condition - condition to check for being true.
213-
* @param print - fucntion providing information string to print in case the assertion fails.
236+
* @param print - function providing information string to print in case the assertion fails.
214237
* @param source_location - location of the assert() invocation in the source code.
215238
*/
216239
#ifdef DEBUG

0 commit comments

Comments
 (0)