util/RuntimeError: add FormatInvalidArgument()
This commit is contained in:
parent
39dc83bd82
commit
3d960b5e55
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2013-2015 Max Kellermann <max.kellermann@gmail.com>
|
* Copyright (C) 2013-20157Max Kellermann <max.kellermann@gmail.com>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@ -44,4 +44,13 @@ FormatRuntimeError(const char *fmt, Args&&... args) noexcept
|
|||||||
return std::runtime_error(buffer);
|
return std::runtime_error(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename... Args>
|
||||||
|
inline std::invalid_argument
|
||||||
|
FormatInvalidArgument(const char *fmt, Args&&... args) noexcept
|
||||||
|
{
|
||||||
|
char buffer[1024];
|
||||||
|
snprintf(buffer, sizeof(buffer), fmt, std::forward<Args>(args)...);
|
||||||
|
return std::invalid_argument(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user