diff --git a/vclib/core/include/vclib/space/core/bit_set.h b/vclib/core/include/vclib/space/core/bit_set.h index 25d3bee3e..29d45a480 100644 --- a/vclib/core/include/vclib/space/core/bit_set.h +++ b/vclib/core/include/vclib/space/core/bit_set.h @@ -77,8 +77,12 @@ class BitSet template BitSet(std::initializer_list l) { - for (const auto& i : l) - at(i) = true; + for (const auto& i : l) { + if constexpr (std::is_enum_v) + at(toUnderlying(i)) = true; + else + at(i) = true; + } } /** @@ -98,8 +102,7 @@ class BitSet "BitSet: list size is greater than the number of bits of the " "BitSet"); - uint i = 0; - for (const auto& b : l) + for (uint i = 0; const auto& b : l) at(i++) = b; } diff --git a/vclib/processing/include/vclib/processing/actions/filter_mesh/apply/laplacian_smoothing_filter.h b/vclib/processing/include/vclib/processing/actions/filter_mesh/apply/laplacian_smoothing_filter.h index 162bb723e..6b4e63616 100644 --- a/vclib/processing/include/vclib/processing/actions/filter_mesh/apply/laplacian_smoothing_filter.h +++ b/vclib/processing/include/vclib/processing/actions/filter_mesh/apply/laplacian_smoothing_filter.h @@ -61,9 +61,7 @@ class LaplacianSmoothingFilter : public FilterMeshAction { std::pair> par; par.first = MeshParameter("input_output", "Input/Output Mesh", ""); - par.second = BitSet( - {toUnderlying(MeshIType::TRI_MESH), - toUnderlying(MeshIType::POLY_MESH)}); + par.second = BitSet({MeshIType::TRI_MESH, MeshIType::POLY_MESH}); return {par}; } diff --git a/vclib/render/src/vclib/bgfx/drawable/drawable_axis.cpp b/vclib/render/src/vclib/bgfx/drawable/drawable_axis.cpp index 5f09647b0..793618ff0 100644 --- a/vclib/render/src/vclib/bgfx/drawable/drawable_axis.cpp +++ b/vclib/render/src/vclib/bgfx/drawable/drawable_axis.cpp @@ -88,10 +88,7 @@ void DrawableAxis::createAxis() using MRI = MeshRenderInfo; using enum MRI::Buffers; - MRI::BuffersBitSet btf = { - toUnderlying(VERTICES), - toUnderlying(VERT_NORMALS), - toUnderlying(TRIANGLES)}; + MRI::BuffersBitSet btf = {VERTICES, VERT_NORMALS, TRIANGLES}; mArrowBuffers[0] = MeshRenderBuffers(AXIS_MESHES.first, btf);