LIBINT  2.6.0
small_vector.h
1 /*
2  * Copyright (C) 2004-2019 Edward F. Valeev
3  *
4  * This file is part of Libint.
5  *
6  * Libint is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Libint is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with Libint. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 #ifndef _libint2_include_libint2_util_smallvector_h_
22 #define _libint2_include_libint2_util_smallvector_h_
23 
24 // Boost.Container's small_vector is interoperable with std::vector starting with version 1.61 or later
25 // see https://www.boost.org/doc/libs/1_61_0/doc/html/boost/container/small_vector.html#idp20337968-bb
26 #if __has_include(<boost/version.hpp>) && __has_include(<boost/container/small_vector.hpp>) && !defined(LIBINT2_DISABLE_BOOST_CONTAINER_SMALL_VECTOR)
27 # include <boost/version.hpp> // read in version and do version check
28 # if defined(BOOST_VERSION)
29 # if (BOOST_VERSION / 100000 == 1) && ((BOOST_VERSION / 100 % 1000) >= 61)
30 # define LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H 1
31 # if !defined(LIBINT2_SVECTOR_OPTIMIZED_RANK) // user can override by defining LIBINT2_SVECTOR_OPTIMIZED_RANK
32 # define LIBINT2_SVECTOR_OPTIMIZED_RANK 6
33 # endif
34 # include <boost/container/small_vector.hpp>
35 # endif // boost version >= 1.61
36 # endif // defined(BOOST_VERSION)
37 #else
38 # include <vector>
39 #endif
40 
41 namespace libint2 {
42 
43 #if defined(LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H)
44 #define LIBINT2_USES_BOOST_CONTAINER_SMALL_VECTOR_AS_SVECTOR 1
45 template <typename T> using svector = boost::container::small_vector<T, LIBINT2_SVECTOR_OPTIMIZED_RANK>;
46 #else
47 template <typename T> using svector = std::vector<T>;
48 #endif
49 
50 } // namespace libint2
51 
52 #endif // header guard
53 
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24