LIBINT 2.7.2
small_vector.h
1/*
2 * Copyright (C) 2004-2021 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 defined(__has_include)
27# if __has_include(<boost/version.hpp>) && __has_include(<boost/container/small_vector.hpp>) && !defined(LIBINT2_DISABLE_BOOST_CONTAINER_SMALL_VECTOR)
28# include <boost/version.hpp> // read in version and do version check
29# if defined(BOOST_VERSION)
30# if (BOOST_VERSION / 100000 == 1) && ((BOOST_VERSION / 100 % 1000) >= 61)
31# define LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H 1
32# if !defined(LIBINT2_SVECTOR_OPTIMIZED_RANK) // user can override by defining LIBINT2_SVECTOR_OPTIMIZED_RANK
33# define LIBINT2_SVECTOR_OPTIMIZED_RANK 6
34# endif
35# include <boost/container/small_vector.hpp>
36# endif // boost version >= 1.61
37# endif // defined(BOOST_VERSION)
38# else
39# include <vector>
40# endif
41#else // defined(__has_include)
42# include <vector>
43#endif // defined(__has_include)
44
45namespace libint2 {
46
47#if defined(LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H)
48#define LIBINT2_USES_BOOST_CONTAINER_SMALL_VECTOR_AS_SVECTOR 1
49template <typename T> using svector = boost::container::small_vector<T, LIBINT2_SVECTOR_OPTIMIZED_RANK>;
50#else
51template <typename T> using svector = std::vector<T>;
52#endif
53
54} // namespace libint2
55
56#endif // header guard
57
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24