Added throw specification.
[libsex.git] / include / libsex / utility.ixx
blobc3ebeb66b113c14d55a1e725318c324a9af9148b
1 #include <libsex/Exception.hxx> // Exception::LENGTH
3 namespace libsex {
5 template <typename T>
6 T formatted(const char* const file,
7         unsigned short line,
8         ...) throw()
10         // Temporary string should be initialized
11         // with 0 to not forget a trailing 0.
12         char buf[Exception::LENGTH + 1] = { 0 };
14         va_list ap;
15         va_start(ap, line);
16         // Fill buf with formatted T::TEMPLATE message.
17         vformat(
18                 buf, Exception::LENGTH + 1,
19                 file, line,
20                 T::TEMPLATE, ap);\
21         va_end(ap);
23         return T(buf);
26 }; // namespace