]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/preprocessor/doc/ref/include_self.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / preprocessor / doc / ref / include_self.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3 <title>BOOST_PP_INCLUDE_SELF</title>
4 <link rel="stylesheet" type="text/css" href="../styles.css">
5</head>
6<body>
7 <div style="margin-left: 0px;">
8 The <b>BOOST_PP_INCLUDE_SELF</b> macro includes a file indirectly.
9 </div>
10 <h4>Usage</h4>
11 <div class="code">
12 #include <b>BOOST_PP_INCLUDE_SELF</b>()
13 </div>
14 <h4>Arguments</h4>
15 <dl>
16 <dt>filename</dt>
17 <dd>
18 A quoted or angle-bracketed filename to be included by <b>BOOST_PP_INCLUDE_SELF</b>.
19 </dd>
20 </dl>
21 <h4>Remarks</h4>
22 <div>
23 <b>BOOST_PP_INDIRECT_SELF</b> must be defined prior to using this macro.
24 </div>
25 <div>
26 Most preprocessors will not allow a file to directly include itself--even when the file protects itself from such a scenario.&nbsp;
27 This macro, in combination with <b>BOOST_PP_INDIRECT_SELF</b> allows a file to include itself indirectly.
28 </div>
29 <div>
30 While <b>BOOST_PP_INDIRECT_SELF</b> is being included, <b>BOOST_PP_INCLUDE_SELF</b> defines the macro <b>BOOST_PP_IS_SELFISH</b> to <i>1</i>.&nbsp;
31 When it returns from the inclusion, <b>BOOST_PP_IS_SELFISH</b> is undefined.
32 </div>
33 <h4>See Also</h4>
34 <ul>
35 <li><a href="indirect_self.html">BOOST_PP_INDIRECT_SELF</a></li>
36 <li><a href="is_selfish.html">BOOST_PP_IS_SELFISH</a></li>
37 </ul>
38 <h4>Requirements</h4>
39 <div>
40 <b>Header:</b> &nbsp;<a href="../headers/iteration/self.html">&lt;boost/preprocessor/iteration/self.hpp&gt;</a>
41 </div>
42 <h4>Sample Code</h4>
43<div><pre>
44// file.h
45#if !<a href="is_selfish.html">BOOST_PP_IS_SELFISH</a>
46
47 #ifndef FILE_H_
48 #define FILE_H_
49
50 #include &lt;<a href="../headers/iteration/self.html">boost/preprocessor/iteration/self.hpp</a>&gt;
51
52 #define NAME X
53 struct NAME {
54 // ...
55 #define <a href="indirect_self.html">BOOST_PP_INDIRECT_SELF</a> "file.h"
56 #include <a href="include_self.html">BOOST_PP_INCLUDE_SELF</a>()
57 };
58
59 #define NAME Y
60 struct NAME {
61 // ...
62 #define <a href="indirect_self.html">BOOST_PP_INDIRECT_SELF</a> "file.h"
63 #include <a href="include_self.html">BOOST_PP_INCLUDE_SELF</a>()
64 };
65
66 #define NAME Z
67 struct NAME {
68 // ...
69 #define <a href="indirect_self.html">BOOST_PP_INDIRECT_SELF</a> "file.h"
70 #include <a href="include_self.html">BOOST_PP_INCLUDE_SELF</a>()
71 };
72
73 #endif
74
75#else
76
77 inline bool validate(NAME* p) {
78 return true;
79 }
80
81 template&lt;class T&gt; bool validate(T* p) {
82 return dynamic_cast&lt;NAME*&gt;(p);
83 }
84
85 #undef NAME
86
87#endif
88</pre></div>
89 <hr size="1">
90 <div style="margin-left: 0px;">
91