/** \file share.d
* \brief Mixin templates and exceptions shared between modules.
*
* Written by Ben Hinkle and released to the public domain, as
* explained at http://creativecommons.org/licenses/publicdomain
* Email comments and bug reports to ben.hinkle@gmail.com
*/
module mintl.share;
public import std.stdarg;
public import std.boxer;
const bit ReadOnly = true;
//version = WithBox;
/** Return the length of an argument in bytes. */
size_t va_argumentLength(size_t baseLength)
{
return (baseLength + int.sizeof - 1) & ~(int.sizeof - 1);
}
/** A mixin for overloading ~, ~=, and add
* Assumes List class implements dup, addTail, addHead
*/
template MListCatOperators(List) {
/** Appends the specified items to the tail of the target list by
* calling addTail repeatedly.
*/
void add(...) {
vadd(_arguments,_argptr);
}
void vadd(TypeInfo[] arguments, void* argptr) {
for (int k=0;k