23#ifndef VCL_MESH_COMPONENTS_BASE_CONTAINER_COMPONENT_H
24#define VCL_MESH_COMPONENTS_BASE_CONTAINER_COMPONENT_H
28#include <vclib/space/core.h>
50using ContCompBase = std::conditional_t<
51 std::is_same_v<AD, void>,
52 Component<DC, CT, Vector<T, N>, El, v, o, PT...>,
53 Component<DC, CT, std::tuple<Vector<T, N>, AD>, El, v, o, PT...>>;
110 typename DerivedComponent,
114 typename AdditionalData,
115 typename ParentElemType,
119 typename... PointedTypes>
120class ContainerComponent :
121 public detail::ContCompBase<
133 static constexpr bool HAS_ADDITIONAL_DATA =
134 !std::is_same_v<AdditionalData, void>;
136 using Base = detail::ContCompBase<
159 static const bool TIED_TO_VERTEX_NUMBER = TTVN;
161 static const int SIZE = N;
166 using Iterator = Vector<T, N>::Iterator;
167 using ConstIterator = Vector<T, N>::ConstIterator;
179 if constexpr (!Base::IS_VERTICAL) {
180 if constexpr (N >= 0) {
181 Base::data().fill(T());
194 if constexpr (N >= 0) {
197 container().fill(T());
206 Vector<T, N>& container()
208 if constexpr (HAS_ADDITIONAL_DATA) {
209 return std::get<0>(Base::data());
216 const Vector<T, N>& container()
const
218 if constexpr (HAS_ADDITIONAL_DATA) {
219 return std::get<0>(Base::data());
226 template<
typename AdDt = AdditionalData>
227 AdDt& additionalData()
requires (HAS_ADDITIONAL_DATA)
229 return std::get<1>(Base::data());
232 template<
typename AdDt = AdditionalData>
233 const AdDt& additionalData() const requires (HAS_ADDITIONAL_DATA)
235 return std::get<1>(Base::data());