mirror of
https://github.com/audacity/linuxdeploy.git
synced 2026-04-13 06:51:05 -05:00
Add reusable assert template
This commit is contained in:
17
include/linuxdeploy/util/assert.h
Normal file
17
include/linuxdeploy/util/assert.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
// system headers
|
||||
#include <stdexcept>
|
||||
|
||||
namespace linuxdeploy {
|
||||
namespace util {
|
||||
namespace assert {
|
||||
template<typename T>
|
||||
void assert_not_empty(T container) {
|
||||
if (container.empty()) {
|
||||
throw std::invalid_argument{"container must not be empty"};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user