Skip to content

Commit

Permalink
Prevent the usage of bool containers.
Browse files Browse the repository at this point in the history
Since vecmem::vector<bool> cannot provide a memory block like
what all other parts of the code assume, just prevent using
"bool" as an element type in any container. Even if technically
buffer types could function with that type.
  • Loading branch information
krasznaa committed Sep 25, 2023
1 parent a47377e commit 066cf9a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/include/vecmem/containers/data/jagged_vector_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ namespace data {
template <typename T>
class jagged_vector_view {

/// We cannot use boolean types.
static_assert(!std::is_same<typename std::remove_cv<T>::type, bool>::value,
"bool is not supported in VecMem containers");

public:
/// Size type used in the class
typedef std::size_t size_type;
Expand Down
7 changes: 6 additions & 1 deletion core/include/vecmem/containers/data/vector_view.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* VecMem project, part of the ACTS project (R&D line)
*
* (c) 2021 CERN for the benefit of the ACTS project
* (c) 2021-2023 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand Down Expand Up @@ -37,6 +37,11 @@ namespace data {
template <typename TYPE>
class vector_view {

/// We cannot use boolean types.
static_assert(
!std::is_same<typename std::remove_cv<TYPE>::type, bool>::value,
"bool is not supported in VecMem containers");

public:
/// Size type used in the class
typedef unsigned int size_type;
Expand Down

0 comments on commit 066cf9a

Please sign in to comment.