Initial commit: ROW Client source code

Game client codebase including:
- CharacterActionControl: Character and creature management
- GlobalScript: Network, items, skills, quests, utilities
- RYLClient: Main client application with GUI and event handlers
- Engine: 3D rendering engine (RYLGL)
- MemoryManager: Custom memory allocation
- Library: Third-party dependencies (DirectX, boost, etc.)
- Tools: Development utilities

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-29 16:24:34 +09:00
commit e067522598
5135 changed files with 1745744 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_POOL_CT_GCD_LCM_HPP
#define BOOST_POOL_CT_GCD_LCM_HPP
#include <boost/static_assert.hpp>
#include <boost/type_traits/ice.hpp>
namespace boost {
namespace details {
namespace pool {
// Compile-time calculation of greatest common divisor and least common multiple
//
// ct_gcd is a compile-time algorithm that calculates the greatest common
// divisor of two unsigned integers, using Euclid's algorithm.
//
// assumes: A != 0 && B != 0
//
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
namespace details {
template <unsigned A, unsigned B, bool Bis0>
struct ct_gcd_helper;
template <unsigned A, unsigned B>
struct ct_gcd_helper<A, B, false>
{
BOOST_STATIC_CONSTANT(unsigned, A_mod_B_ = A % B);
BOOST_STATIC_CONSTANT(unsigned, value =
(::boost::details::pool::details::ct_gcd_helper<
B, static_cast<unsigned>(A_mod_B_),
::boost::type_traits::ice_eq<A_mod_B_, 0>::value
>::value) );
};
template <unsigned A, unsigned B>
struct ct_gcd_helper<A, B, true>
{
BOOST_STATIC_CONSTANT(unsigned, value = A);
};
} // namespace details
template <unsigned A, unsigned B>
struct ct_gcd
{
BOOST_STATIC_ASSERT(A != 0 && B != 0);
BOOST_STATIC_CONSTANT(unsigned, value =
(::boost::details::pool::details::ct_gcd_helper<A, B, false>::value) );
};
#else
// Thanks to Peter Dimov for providing this workaround!
namespace details {
template<unsigned A> struct ct_gcd2
{
template<unsigned B>
struct helper
{
BOOST_STATIC_CONSTANT(unsigned, value = ct_gcd2<B>::helper<A % B>::value);
};
template<>
struct helper<0>
{
BOOST_STATIC_CONSTANT(unsigned, value = A);
};
};
} // namespace details
template<unsigned A, unsigned B> struct ct_gcd
{
BOOST_STATIC_ASSERT(A != 0 && B != 0);
enum { value = details::ct_gcd2<A>::helper<B>::value };
};
#endif
//
// ct_lcm is a compile-time algorithm that calculates the least common
// multiple of two unsigned integers.
//
// assumes: A != 0 && B != 0
//
template <unsigned A, unsigned B>
struct ct_lcm
{
BOOST_STATIC_CONSTANT(unsigned, value =
(A / ::boost::details::pool::ct_gcd<A, B>::value * B) );
};
} // namespace pool
} // namespace details
} // namespace boost
#endif

View File

@@ -0,0 +1,107 @@
m4_dnl
m4_dnl Copyright (C) 2000 Stephen Cleary
m4_dnl
m4_dnl Distributed under the Boost Software License, Version 1.0. (See accompany-
m4_dnl ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
m4_dnl
m4_dnl See http://www.boost.org for updates, documentation, and revision history.
m4_dnl
m4_dnl
m4_dnl
m4_dnl BOOST_M4_FOR: repeat a given text for a range of values
m4_dnl $1 - variable to hold the current value.
m4_dnl $2 - the starting value.
m4_dnl $3 - the ending value (text is _not_ repeated for this value).
m4_dnl $4 - the text to repeat.
m4_dnl $5 - the delimeter text (optional).
m4_dnl
m4_dnl If the starting value is < ending value:
m4_dnl Will repeat $4, binding $1 to the values in the range [$2, $3).
m4_dnl Else (that is, starting value >= ending value):
m4_dnl Will do nothing
m4_dnl Repeats $5 in-between each occurrence of $4
m4_dnl
m4_dnl Logic:
m4_dnl Set $1 to $2 and call BOOST_M4_FOR_LIST_HELPER:
m4_dnl If $1 >= $3, do nothing
m4_dnl Else
m4_dnl output $4,
m4_dnl set $1 to itself incremented,
m4_dnl If $1 != $3, output $5,
m4_dnl and use recursion
m4_dnl
m4_define(`BOOST_M4_FOR',
`m4_ifelse(m4_eval($# < 4 || $# > 5), 1,
`m4_errprint(m4___file__:m4___line__: `Boost m4 script: BOOST_M4_FOR: Wrong number of arguments ($#)')',
`m4_pushdef(`$1', `$2')BOOST_M4_FOR_HELPER($@)m4_popdef(`$1')')')m4_dnl
m4_define(`BOOST_M4_FOR_HELPER',
`m4_ifelse(m4_eval($1 >= $3), 1, ,
`$4`'m4_define(`$1', m4_incr($1))m4_ifelse(m4_eval($1 != $3), 1, `$5')`'BOOST_M4_FOR_HELPER($@)')')m4_dnl
m4_dnl
m4_dnl Testing/Examples:
m4_dnl
m4_dnl The following line will output:
m4_dnl "repeat.m4:42: Boost m4 script: BOOST_M4_FOR: Wrong number of arguments (3)"
m4_dnl BOOST_M4_FOR(i, 1, 3)
m4_dnl
m4_dnl The following line will output:
m4_dnl "repeat.m4:46: Boost m4 script: BOOST_M4_FOR: Wrong number of arguments (6)"
m4_dnl BOOST_M4_FOR(i, 1, 3, i, ` ', 13)
m4_dnl
m4_dnl The following line will output (nothing):
m4_dnl ""
m4_dnl BOOST_M4_FOR(i, 7, 0, i )
m4_dnl
m4_dnl The following line will output (nothing):
m4_dnl ""
m4_dnl BOOST_M4_FOR(i, 0, 0, i )
m4_dnl
m4_dnl The following line will output:
m4_dnl "0 1 2 3 4 5 6 "
m4_dnl BOOST_M4_FOR(i, 0, 7, i )
m4_dnl
m4_dnl The following line will output:
m4_dnl "-13 -12 -11 "
m4_dnl BOOST_M4_FOR(i, -13, -10, i )
m4_dnl
m4_dnl The following two lines will output:
m4_dnl "(0, 0) (0, 1) (0, 2) (0, 3) "
m4_dnl "(1, 0) (1, 1) (1, 2) (1, 3) "
m4_dnl "(2, 0) (2, 1) (2, 2) (2, 3) "
m4_dnl "(3, 0) (3, 1) (3, 2) (3, 3) "
m4_dnl "(4, 0) (4, 1) (4, 2) (4, 3) "
m4_dnl "(5, 0) (5, 1) (5, 2) (5, 3) "
m4_dnl "(6, 0) (6, 1) (6, 2) (6, 3) "
m4_dnl "(7, 0) (7, 1) (7, 2) (7, 3) "
m4_dnl ""
m4_dnl BOOST_M4_FOR(i, 0, 8, BOOST_M4_FOR(j, 0, 4, (i, j) )
m4_dnl )
m4_dnl
m4_dnl The following line will output (nothing):
m4_dnl ""
m4_dnl BOOST_M4_FOR(i, 7, 0, i, |)
m4_dnl
m4_dnl The following line will output (nothing):
m4_dnl ""
m4_dnl BOOST_M4_FOR(i, 0, 0, i, |)
m4_dnl
m4_dnl The following line will output:
m4_dnl "0|1|2|3|4|5|6"
m4_dnl BOOST_M4_FOR(i, 0, 7, i, |)
m4_dnl
m4_dnl The following line will output:
m4_dnl "-13, -12, -11"
m4_dnl BOOST_M4_FOR(i, -13, -10, i, `, ')
m4_dnl
m4_dnl The following two lines will output:
m4_dnl "[(0, 0), (0, 1), (0, 2), (0, 3)],"
m4_dnl "[(1, 0), (1, 1), (1, 2), (1, 3)],"
m4_dnl "[(2, 0), (2, 1), (2, 2), (2, 3)],"
m4_dnl "[(3, 0), (3, 1), (3, 2), (3, 3)],"
m4_dnl "[(4, 0), (4, 1), (4, 2), (4, 3)],"
m4_dnl "[(5, 0), (5, 1), (5, 2), (5, 3)],"
m4_dnl "[(6, 0), (6, 1), (6, 2), (6, 3)],"
m4_dnl "[(7, 0), (7, 1), (7, 2), (7, 3)]"
m4_dnl BOOST_M4_FOR(i, 0, 8, `[BOOST_M4_FOR(j, 0, 4, (i, j), `, ')]', `,
m4_dnl ')
m4_dnl

View File

@@ -0,0 +1,58 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_POOL_GCD_LCM_HPP
#define BOOST_POOL_GCD_LCM_HPP
namespace boost {
namespace details {
namespace pool {
// Greatest common divisor and least common multiple
//
// gcd is an algorithm that calculates the greatest common divisor of two
// integers, using Euclid's algorithm.
//
// Pre: A > 0 && B > 0
// Recommended: A > B
template <typename Integer>
Integer gcd(Integer A, Integer B)
{
do
{
const Integer tmp(B);
B = A % B;
A = tmp;
} while (B != 0);
return A;
}
//
// lcm is an algorithm that calculates the least common multiple of two
// integers.
//
// Pre: A > 0 && B > 0
// Recommended: A > B
template <typename Integer>
Integer lcm(const Integer & A, const Integer & B)
{
Integer ret = A;
ret /= gcd(A, B);
ret *= B;
return ret;
}
} // namespace pool
} // namespace details
} // namespace boost
#endif

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_POOL_GUARD_HPP
#define BOOST_POOL_GUARD_HPP
// Extremely Light-Weight guard glass
namespace boost {
namespace details {
namespace pool {
template <typename Mutex>
class guard
{
private:
Mutex & mtx;
guard(const guard &);
void operator=(const guard &);
public:
explicit guard(Mutex & nmtx)
:mtx(nmtx) { mtx.lock(); }
~guard() { mtx.unlock(); }
};
} // namespace pool
} // namespace details
} // namespace boost
#endif

View File

@@ -0,0 +1,145 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_POOL_MUTEX_HPP
#define BOOST_POOL_MUTEX_HPP
#include <boost/config.hpp> // for workarounds
// Extremely Light-Weight wrapper classes for OS thread synchronization
// Configuration: for now, we just choose between pthread or Win32 mutexes or none
#define BOOST_MUTEX_HELPER_NONE 0
#define BOOST_MUTEX_HELPER_WIN32 1
#define BOOST_MUTEX_HELPER_PTHREAD 2
#if !defined(BOOST_HAS_THREADS) && !defined(BOOST_NO_MT)
# define BOOST_NO_MT
#endif
#ifdef BOOST_NO_MT
// No multithreading -> make locks into no-ops
#define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_NONE
#else
#ifdef BOOST_WINDOWS
#define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_WIN32
#else
#include <unistd.h>
#ifdef _POSIX_THREADS
#define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_PTHREAD
#endif
#endif
#endif
#ifndef BOOST_MUTEX_HELPER
#error Unable to determine platform mutex type; define BOOST_NO_MT to assume single-threaded
#endif
#ifndef BOOST_NO_MT
# ifdef BOOST_WINDOWS
# include <windows.h>
# endif
# ifdef _POSIX_THREADS
# include <pthread.h>
# endif
#endif
namespace boost {
namespace details {
namespace pool {
#ifndef BOOST_NO_MT
#ifdef BOOST_WINDOWS
class win32_mutex
{
private:
CRITICAL_SECTION mtx;
win32_mutex(const win32_mutex &);
void operator=(const win32_mutex &);
public:
win32_mutex()
{ InitializeCriticalSection(&mtx); }
~win32_mutex()
{ DeleteCriticalSection(&mtx); }
void lock()
{ EnterCriticalSection(&mtx); }
void unlock()
{ LeaveCriticalSection(&mtx); }
};
#endif // defined(BOOST_WINDOWS)
#ifdef _POSIX_THREADS
class pthread_mutex
{
private:
pthread_mutex_t mtx;
pthread_mutex(const pthread_mutex &);
void operator=(const pthread_mutex &);
public:
pthread_mutex()
{ pthread_mutex_init(&mtx, 0); }
~pthread_mutex()
{ pthread_mutex_destroy(&mtx); }
void lock()
{ pthread_mutex_lock(&mtx); }
void unlock()
{ pthread_mutex_unlock(&mtx); }
};
#endif // defined(_POSIX_THREADS)
#endif // !defined(BOOST_NO_MT)
class null_mutex
{
private:
null_mutex(const null_mutex &);
void operator=(const null_mutex &);
public:
null_mutex() { }
static void lock() { }
static void unlock() { }
};
#if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE
typedef null_mutex default_mutex;
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_WIN32
typedef win32_mutex default_mutex;
#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_PTHREAD
typedef pthread_mutex default_mutex;
#endif
} // namespace pool
} // namespace details
} // namespace boost
#undef BOOST_MUTEX_HELPER_WIN32
#undef BOOST_MUTEX_HELPER_PTHREAD
#undef BOOST_MUTEX_HELPER_NONE
#undef BOOST_MUTEX_HELPER
#endif

View File

@@ -0,0 +1,24 @@
@echo off
rem
rem Copyright (C) 2000, 2001 Stephen Cleary
rem
rem Distributed under the Boost Software License, Version 1.0. (See accompany-
rem ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
rem Check for Windows NT
if %OS%==Windows_NT goto NT
rem Not NT - run m4 as normal, then exit
m4 -P -E -DNumberOfArguments=%1 pool_construct.m4 > pool_construct.inc
goto end
rem DJGPP programs (including m4) running on Windows/NT do NOT support long
rem file names (see the DJGPP v2 FAQ, question 8.1)
rem Note that the output doesn't have to be a short name because it's an
rem argument to the command shell, not m4.
:NT
m4 -P -E -DNumberOfArguments=%1 < pool_construct.m4 > pool_construct.inc
:end

View File

@@ -0,0 +1,853 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
// This file was AUTOMATICALLY GENERATED from "pool_c~1.m4"
// Do NOT include directly!
// Do NOT edit!
template <typename T0>
element_type * construct(T0 & a0)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(const T0 & a0)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(volatile T0 & a0)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0>
element_type * construct(const volatile T0 & a0)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, const T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, const T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, const T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(T0 & a0, const volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(volatile T0 & a0, const volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(volatile T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const volatile T0 & a0, const volatile T1 & a1, const volatile T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}

View File

@@ -0,0 +1,84 @@
m4_dnl
m4_dnl Copyright (C) 2000 Stephen Cleary
m4_dnl
m4_dnl Distributed under the Boost Software License, Version 1.0. (See accompany-
m4_dnl ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
m4_dnl
m4_dnl See http://www.boost.org for updates, documentation, and revision history.
m4_dnl
m4_dnl
m4_dnl
m4_dnl Avoid the use of any m4_* identifiers in this header file,
m4_dnl as that may cause incompatibility problems with future
m4_dnl versions of m4.
m4_dnl
m4_dnl This is a normal header file, except that lines starting
m4_dnl with `m4_dnl' will be stripped, TBA_FOR
m4_dnl macros will be replaced with repeated text, and text in
m4_dnl single quotes (`...') will have their single quotes
m4_dnl stripped.
m4_dnl
m4_dnl
m4_dnl Check to make sure NumberOfArguments was defined. If it's not defined,
m4_dnl default to 3
m4_dnl
m4_ifdef(`NumberOfArguments', , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is not defined; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_ifelse(NumberOfArguments, , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is defined to be empty; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_dnl
m4_dnl Check to make sure NumberOfArguments >= 1. If it's not, then fatal error.
m4_dnl
m4_ifelse(m4_eval(NumberOfArguments < 1), 1, `m4_errprint(m4___file__:m4___line__`: NumberOfArguments ('NumberOfArguments`) is less than 1
')m4_m4exit(1)')m4_dnl
m4_dnl
m4_dnl Include the BOOST_M4_FOR macro definition
m4_dnl
m4_include(`for.m4')`'m4_dnl
m4_dnl
m4_dnl Begin the generated file.
m4_dnl
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See accompany-
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
m4_dnl These warnings apply to the file generated from this file.
m4_dnl Of course, you may freely edit this file.
// This file was AUTOMATICALLY GENERATED from "m4___file__"
// Do NOT include directly!
// Do NOT edit!
m4_dnl
m4_dnl First we define a simple 'cv_qual' macro which takes a number, either
m4_dnl 0, 1, 2, or 3, and determines cv-qualification.
m4_dnl
m4_define(`cv_qual',
`m4_ifelse($1, 0, `',
`m4_ifelse($1, 1, `const ',
`m4_ifelse($1, 2, `volatile ',
`m4_ifelse($1, 3, `const volatile ',
`m4_errprint(m4___file__:m4___line__: `Boost m4 script: cv-determiner: Not 0, 1, 2, or 3 (was '$1`)')'
)')')')')m4_dnl
m4_dnl
m4_dnl Next we go through the actual loop. For each number of arguments from
m4_dnl 1 to NumberOfArguments, we create a template function that takes that
m4_dnl many template arguments, and also generate all cv-qualified permutations
m4_dnl of that function.
m4_dnl
BOOST_M4_FOR(N, 1, NumberOfArguments + 1,
`BOOST_M4_FOR(cv, 0, m4_eval(4 ** N),
`template <BOOST_M4_FOR(i, 0, N, `typename T`'i', `, ')>
element_type * construct(BOOST_M4_FOR(i, 0, N,
`cv_qual(m4_eval((cv >> (i * 2)) % 4))T`'i & a`'i', `, '))
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
catch (...) { free(ret); throw; }
return ret;
}
')')

View File

@@ -0,0 +1,11 @@
#!/bin/sh
#
# Copyright (C) 2000 Stephen Cleary
#
# Distributed under the Boost Software License, Version 1.0. (See accompany-
# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# See http://www.boost.org for updates, documentation, and revision history.
#
m4 -P -E -DNumberOfArguments=$1 pool_construct.m4 > pool_construct.inc

View File

@@ -0,0 +1,25 @@
@echo off
rem
rem Copyright (C) 2001 Stephen Cleary
rem
rem Distributed under the Boost Software License, Version 1.0. (See accompany-
rem ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
rem
rem See http://www.boost.org for updates, documentation, and revision history.
rem
rem Check for Windows NT
if %OS%==Windows_NT goto NT
rem Not NT - run m4 as normal, then exit
m4 -P -E -DNumberOfArguments=%1 pool_construct_simple.m4 > pool_construct_simple.inc
goto end
rem DJGPP programs (including m4) running on Windows/NT do NOT support long
rem file names (see the DJGPP v2 FAQ, question 8.1)
rem Note that the output doesn't have to be a short name because it's an
rem argument to the command shell, not m4.
:NT
m4 -P -E -DNumberOfArguments=%1 < pool_construct_simple.m4 > pool_construct_simple.inc
:end

View File

@@ -0,0 +1,43 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
// This file was AUTOMATICALLY GENERATED from "stdin"
// Do NOT include directly!
// Do NOT edit!
template <typename T0>
element_type * construct(const T0 & a0)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1>
element_type * construct(const T0 & a0, const T1 & a1)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1); }
catch (...) { free(ret); throw; }
return ret;
}
template <typename T0, typename T1, typename T2>
element_type * construct(const T0 & a0, const T1 & a1, const T2 & a2)
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(a0, a1, a2); }
catch (...) { free(ret); throw; }
return ret;
}

View File

@@ -0,0 +1,73 @@
m4_dnl
m4_dnl Copyright (C) 2001 Stephen Cleary
m4_dnl
m4_dnl Distributed under the Boost Software License, Version 1.0. (See accompany-
m4_dnl ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
m4_dnl
m4_dnl See http://www.boost.org for updates, documentation, and revision history.
m4_dnl
m4_dnl
m4_dnl
m4_dnl Avoid the use of any m4_* identifiers in this header file,
m4_dnl as that may cause incompatibility problems with future
m4_dnl versions of m4.
m4_dnl
m4_dnl This is a normal header file, except that lines starting
m4_dnl with `m4_dnl' will be stripped, TBA_FOR
m4_dnl macros will be replaced with repeated text, and text in
m4_dnl single quotes (`...') will have their single quotes
m4_dnl stripped.
m4_dnl
m4_dnl
m4_dnl Check to make sure NumberOfArguments was defined. If it's not defined,
m4_dnl default to 3
m4_dnl
m4_ifdef(`NumberOfArguments', , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is not defined; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_ifelse(NumberOfArguments, , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is defined to be empty; defaulting to 3
')m4_define(`NumberOfArguments', 3)')m4_dnl
m4_dnl
m4_dnl Check to make sure NumberOfArguments >= 1. If it's not, then fatal error.
m4_dnl
m4_ifelse(m4_eval(NumberOfArguments < 1), 1, `m4_errprint(m4___file__:m4___line__`: NumberOfArguments ('NumberOfArguments`) is less than 1
')m4_m4exit(1)')m4_dnl
m4_dnl
m4_dnl Include the BOOST_M4_FOR macro definition
m4_dnl
m4_include(`for.m4')`'m4_dnl
m4_dnl
m4_dnl Begin the generated file.
m4_dnl
// Copyright (C) 2000 Stephen Cleary
//
// This file can be redistributed and/or modified under the terms found
// in "copyright.html"
// This software and its documentation is provided "as is" without express or
// implied warranty, and with no claim as to its suitability for any purpose.
//
// See http://www.boost.org for updates, documentation, and revision history.
m4_dnl These warnings apply to the file generated from this file.
m4_dnl Of course, you may freely edit this file.
// This file was AUTOMATICALLY GENERATED from "m4___file__"
// Do NOT include directly!
// Do NOT edit!
m4_dnl
m4_dnl Here we go through the actual loop. For each number of arguments from
m4_dnl 1 to NumberOfArguments, we create a template function that takes that
m4_dnl many template arguments.
m4_dnl
BOOST_M4_FOR(N, 1, NumberOfArguments + 1,
`template <BOOST_M4_FOR(i, 0, N, `typename T`'i', `, ')>
element_type * construct(BOOST_M4_FOR(i, 0, N,
`const T`'i & a`'i', `, '))
{
element_type * const ret = malloc();
if (ret == 0)
return ret;
try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
catch (...) { free(ret); throw; }
return ret;
}
')

View File

@@ -0,0 +1,11 @@
#!/bin/sh
#
# Copyright (C) 2001 Stephen Cleary
#
# Distributed under the Boost Software License, Version 1.0. (See accompany-
# ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# See http://www.boost.org for updates, documentation, and revision history.
#
m4 -P -E -DNumberOfArguments=$1 pool_construct_simple.m4 > pool_construct_simple.inc

View File

@@ -0,0 +1,107 @@
// Copyright (C) 2000 Stephen Cleary
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_POOL_SINGLETON_HPP
#define BOOST_POOL_SINGLETON_HPP
// The following code might be put into some Boost.Config header in a later revision
#ifdef __BORLANDC__
# pragma option push -w-inl
#endif
//
// The following helper classes are placeholders for a generic "singleton"
// class. The classes below support usage of singletons, including use in
// program startup/shutdown code, AS LONG AS there is only one thread
// running before main() begins, and only one thread running after main()
// exits.
//
// This class is also limited in that it can only provide singleton usage for
// classes with default constructors.
//
// The design of this class is somewhat twisted, but can be followed by the
// calling inheritance. Let us assume that there is some user code that
// calls "singleton_default<T>::instance()". The following (convoluted)
// sequence ensures that the same function will be called before main():
// instance() contains a call to create_object.do_nothing()
// Thus, object_creator is implicitly instantiated, and create_object
// must exist.
// Since create_object is a static member, its constructor must be
// called before main().
// The constructor contains a call to instance(), thus ensuring that
// instance() will be called before main().
// The first time instance() is called (i.e., before main()) is the
// latest point in program execution where the object of type T
// can be created.
// Thus, any call to instance() will auto-magically result in a call to
// instance() before main(), unless already present.
// Furthermore, since the instance() function contains the object, instead
// of the singleton_default class containing a static instance of the
// object, that object is guaranteed to be constructed (at the latest) in
// the first call to instance(). This permits calls to instance() from
// static code, even if that code is called before the file-scope objects
// in this file have been initialized.
namespace boost {
namespace details {
namespace pool {
// T must be: no-throw default constructible and no-throw destructible
template <typename T>
struct singleton_default
{
private:
struct object_creator
{
// This constructor does nothing more than ensure that instance()
// is called before main() begins, thus creating the static
// T object before multithreading race issues can come up.
object_creator() { singleton_default<T>::instance(); }
inline void do_nothing() const { }
};
static object_creator create_object;
singleton_default();
public:
typedef T object_type;
// If, at any point (in user code), singleton_default<T>::instance()
// is called, then the following function is instantiated.
static object_type & instance()
{
// This is the object that we return a reference to.
// It is guaranteed to be created before main() begins because of
// the next line.
static object_type obj;
// The following line does nothing else than force the instantiation
// of singleton_default<T>::create_object, whose constructor is
// called before main() begins.
create_object.do_nothing();
return obj;
}
};
template <typename T>
typename singleton_default<T>::object_creator
singleton_default<T>::create_object;
} // namespace pool
} // namespace details
} // namespace boost
// The following code might be put into some Boost.Config header in a later revision
#ifdef __BORLANDC__
# pragma option pop
#endif
#endif