source: NonGTP/Boost/boost/pool/detail/pool_construct.m4 @ 857

Revision 857, 3.4 KB checked in by igarcia, 19 years ago (diff)
Line 
1m4_dnl
2m4_dnl Copyright (C) 2000 Stephen Cleary
3m4_dnl
4m4_dnl This file can be redistributed and/or modified under the terms found
5m4_dnl  in "copyright.html"
6m4_dnl This software and its documentation is provided "as is" without express or
7m4_dnl  implied warranty, and with no claim as to its suitability for any purpose.
8m4_dnl
9m4_dnl See http://www.boost.org for updates, documentation, and revision history.
10m4_dnl
11m4_dnl
12m4_dnl
13m4_dnl Avoid the use of any m4_* identifiers in this header file,
14m4_dnl  as that may cause incompatibility problems with future
15m4_dnl  versions of m4.
16m4_dnl
17m4_dnl This is a normal header file, except that lines starting
18m4_dnl  with `m4_dnl' will be stripped, TBA_FOR
19m4_dnl  macros will be replaced with repeated text, and text in
20m4_dnl  single quotes (`...') will have their single quotes
21m4_dnl  stripped.
22m4_dnl
23m4_dnl
24m4_dnl Check to make sure NumberOfArguments was defined.  If it's not defined,
25m4_dnl  default to 3
26m4_dnl
27m4_ifdef(`NumberOfArguments', , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is not defined; defaulting to 3
28')m4_define(`NumberOfArguments', 3)')m4_dnl
29m4_ifelse(NumberOfArguments, , `m4_errprint(m4___file__:m4___line__`: NumberOfArguments is defined to be empty; defaulting to 3
30')m4_define(`NumberOfArguments', 3)')m4_dnl
31m4_dnl
32m4_dnl Check to make sure NumberOfArguments >= 1.  If it's not, then fatal error.
33m4_dnl
34m4_ifelse(m4_eval(NumberOfArguments < 1), 1, `m4_errprint(m4___file__:m4___line__`: NumberOfArguments ('NumberOfArguments`) is less than 1
35')m4_m4exit(1)')m4_dnl
36m4_dnl
37m4_dnl Include the BOOST_M4_FOR macro definition
38m4_dnl
39m4_include(`for.m4')`'m4_dnl
40m4_dnl
41m4_dnl Begin the generated file.
42m4_dnl
43// Copyright (C) 2000 Stephen Cleary
44//
45// This file can be redistributed and/or modified under the terms found
46//  in "copyright.html"
47// This software and its documentation is provided "as is" without express or
48//  implied warranty, and with no claim as to its suitability for any purpose.
49//
50// See http://www.boost.org for updates, documentation, and revision history.
51
52m4_dnl These warnings apply to the file generated from this file.
53m4_dnl Of course, you may freely edit this file.
54// This file was AUTOMATICALLY GENERATED from "m4___file__"
55//  Do NOT include directly!
56//  Do NOT edit!
57
58m4_dnl
59m4_dnl First we define a simple 'cv_qual' macro which takes a number, either
60m4_dnl   0, 1, 2, or 3, and determines cv-qualification.
61m4_dnl
62m4_define(`cv_qual',
63`m4_ifelse($1, 0, `',
64`m4_ifelse($1, 1, `const ',
65`m4_ifelse($1, 2, `volatile ',
66`m4_ifelse($1, 3, `const volatile ',
67`m4_errprint(m4___file__:m4___line__: `Boost m4 script: cv-determiner: Not 0, 1, 2, or 3 (was '$1`)')'
68)')')')')m4_dnl
69m4_dnl
70m4_dnl Next we go through the actual loop.  For each number of arguments from
71m4_dnl   1 to NumberOfArguments, we create a template function that takes that
72m4_dnl   many template arguments, and also generate all cv-qualified permutations
73m4_dnl   of that function.
74m4_dnl
75BOOST_M4_FOR(N, 1, NumberOfArguments + 1,
76`BOOST_M4_FOR(cv, 0, m4_eval(4 ** N),
77  `template <BOOST_M4_FOR(i, 0, N, `typename T`'i', `, ')>
78element_type * construct(BOOST_M4_FOR(i, 0, N,
79    `cv_qual(m4_eval((cv >> (i * 2)) % 4))T`'i & a`'i', `, '))
80{
81  element_type * const ret = malloc();
82  if (ret == 0)
83    return ret;
84  try { new (ret) element_type(BOOST_M4_FOR(i, 0, N, `a`'i', `, ')); }
85  catch (...) { free(ret); throw; }
86  return ret;
87}
88')')
Note: See TracBrowser for help on using the repository browser.