--- /dev/null
- {
+// libmormegil/abs.hh
+//
+// In jurisdictions where this file would be adjuged to contain copyrightable
+// material, it is copyright 2011 Martin Read, and released to the public
+// under the terms of the Creative Commons Public Domain Dedication (cc-0).
+// It is provided without any warranty, express or implied.
+
+#ifndef libmormegil_abs_hh
+#define libmormegil_abs_hh
+
+namespace libmormegil
+ template<typename T> inline T abs(const T& i)
+ {
+ i < T(0) ? -i : i;
+ }
+}
+#endif // libmormegil_abs_hh
+
+// vim:ts=8:sw=4:expandtab:fo=c
- // stlprintf.hh - (v)sprintf-for-STL-strings for Martin's Dungeon Bash
-/* stlprintf.hh - (v)sprintf-for-STL-strings for libmormegil
- *
- * Copyright 2009 Martin Read and Stefan O'Rear
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
++// stlprintf.hh - (v)sprintf-for-STL-strings
+//
+// In jurisdictions where this file would be adjuged to contain copyrightable
+// material, it is copyright 2011 Martin Read, and released to the public
+// under the terms of the Creative Commons Public Domain Dedication (cc-0).
+// It is provided without any warranty, express or implied.
- #ifndef STLPRINTF_HH
- #define STLPRINTF_HH
+ #ifndef libmormegil_stlprintf_hh
+ #define libmormegil_stlprintf_hh
#include <stdarg.h>
#include <string>
}
#endif
--/* stlprintf.hh */
++// vim:ts=8:sw=4:fo=croq
++// stlprintf.hh