LIBINT 2.9.0
small_vector.h
1/*
2 * Copyright (C) 2004-2024 Edward F. Valeev
3 *
4 * This file is part of Libint library.
5 *
6 * Libint library 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 library 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 library. 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
25// with version 1.61 or later see
26// https://www.boost.org/doc/libs/1_61_0/doc/html/boost/container/small_vector.html#idp20337968-bb
27#if defined(__has_include)
28#if __has_include( \
29 <boost/version.hpp>) && __has_include(<boost/container/small_vector.hpp>) && !defined(LIBINT2_DISABLE_BOOST_CONTAINER_SMALL_VECTOR)
30#include <boost/version.hpp> // read in version and do version check
31#if defined(BOOST_VERSION)
32#if (BOOST_VERSION / 100000 == 1) && ((BOOST_VERSION / 100 % 1000) >= 61)
33#define LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H 1
34#if !defined( \
35 LIBINT2_SVECTOR_OPTIMIZED_RANK) // user can override by defining
36 // LIBINT2_SVECTOR_OPTIMIZED_RANK
37#define LIBINT2_SVECTOR_OPTIMIZED_RANK 6
38#endif
39#include <boost/container/small_vector.hpp>
40#endif // boost version >= 1.61
41#endif // defined(BOOST_VERSION)
42#else
43#include <vector>
44#endif
45#else // defined(__has_include)
46#include <vector>
47#endif // defined(__has_include)
48
49namespace libint2 {
50
51#if defined(LIBINT2_HAS_BOOST_CONTAINER_SMALL_VECTOR_H)
52#define LIBINT2_USES_BOOST_CONTAINER_SMALL_VECTOR_AS_SVECTOR 1
53template <typename T>
54using svector =
55 boost::container::small_vector<T, LIBINT2_SVECTOR_OPTIMIZED_RANK>;
56#else
57template <typename T>
58using svector = std::vector<T>;
59#endif
60
61} // namespace libint2
62
63#endif // header guard
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24