]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
2 | // (C) Copyright Edward Diener 2015 | |
3 | // Use, modification and distribution are subject to the Boost Software License, | |
4 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt). | |
6 | ||
7 | #if !defined(BOOST_VMD_SEQ_PUSH_FRONT_HPP) | |
8 | #define BOOST_VMD_SEQ_PUSH_FRONT_HPP | |
9 | ||
10 | #include <boost/vmd/detail/setup.hpp> | |
11 | ||
12 | #if BOOST_PP_VARIADICS | |
13 | ||
14 | #include <boost/preprocessor/control/iif.hpp> | |
15 | #include <boost/preprocessor/seq/push_front.hpp> | |
16 | #include <boost/vmd/identity.hpp> | |
17 | #include <boost/vmd/is_empty.hpp> | |
18 | ||
19 | /* | |
20 | ||
21 | The succeeding comments in this file are in doxygen format. | |
22 | ||
23 | */ | |
24 | ||
25 | /** \file | |
26 | */ | |
27 | ||
28 | /** \def BOOST_VMD_SEQ_PUSH_FRONT(seq,elem) | |
29 | ||
30 | \brief inserts an element at the beginning of a seq. | |
31 | ||
32 | seq = seq to insert an element at. | |
33 | elem = element to insert. | |
34 | ||
35 | If the seq is an empty seq the result is a seq with the single element. | |
36 | Otherwise the result is a seq after inserting the element at the beginning. | |
37 | */ | |
38 | ||
39 | #define BOOST_VMD_SEQ_PUSH_FRONT(seq,elem) \ | |
40 | BOOST_VMD_IDENTITY_RESULT \ | |
41 | ( \ | |
42 | BOOST_PP_IIF \ | |
43 | ( \ | |
44 | BOOST_VMD_IS_EMPTY(seq), \ | |
45 | BOOST_VMD_IDENTITY((elem)), \ | |
46 | BOOST_PP_SEQ_PUSH_FRONT \ | |
47 | ) \ | |
48 | (seq,elem) \ | |
49 | ) \ | |
50 | /**/ | |
51 | ||
52 | #endif /* BOOST_PP_VARIADICS */ | |
53 | #endif /* BOOST_VMD_SEQ_PUSH_FRONT_HPP */ |