Fix broken build when using the get_at() way wrapper.
This commit is contained in:
parent
41eed2c8ba
commit
84203ee817
2 changed files with 23 additions and 9 deletions
|
@ -167,6 +167,9 @@ namespace vwr {
|
|||
template <typename V2> VecBase& operator/= ( const VecBase<V2>& parOther );
|
||||
|
||||
private:
|
||||
template <std::size_t... I, typename... Args>
|
||||
void assign_values (const bt::index_seq<I...>&, Args... parArgs);
|
||||
|
||||
vector_type m_wrapped;
|
||||
};
|
||||
|
||||
|
@ -189,12 +192,15 @@ namespace vwr {
|
|||
private:
|
||||
static_assert(HasGetAtMethod<VectorWrapperInfo<T>>::value, "You must provide a get_at() static method for this vector_type");
|
||||
typedef typename VectorWrapperInfo<T>::scalar_type scalar_type;
|
||||
using get_at_func = decltype(&VectorWrapperInfo<T>::get_at)(std::size_t, scalar_type&);
|
||||
static_assert(not std::is_rvalue_reference<typename std::result_of<get_at_func>::type>::value, "rvalue ref return types not implemented");
|
||||
static_assert(std::is_lvalue_reference<typename std::result_of<get_at_func>::type>::value, "Read-only vectors not implemented");
|
||||
typedef T vector_type;
|
||||
using get_at_func = decltype(&VectorWrapperInfo<T>::get_at)(std::size_t, vector_type&);
|
||||
using get_at_rettype = typename std::result_of<get_at_func>::type;
|
||||
|
||||
static_assert(not std::is_rvalue_reference<get_at_rettype>::value, "rvalue ref return types not implemented");
|
||||
static_assert(std::is_lvalue_reference<get_at_rettype>::value, "Read-only vectors not implemented");
|
||||
|
||||
public:
|
||||
static typename VectorWrapperInfo<T>::scalar_type& get_at ( T& parVec, std::size_t parIndex );
|
||||
static get_at_rettype get_at ( T& parVec, std::size_t parIndex );
|
||||
};
|
||||
|
||||
template <typename V, bool Enabled> struct Vec1Promotion;
|
||||
|
|
|
@ -41,10 +41,18 @@ namespace vwr {
|
|||
VecGetter<V>::get_at(m_wrapped, 0) = parX;
|
||||
VecGetter<V>::get_at(m_wrapped, 1) = parY;
|
||||
|
||||
const scalar_type args[sizeof...(Args)] = {parArgs...};
|
||||
for (std::size_t z = 0; z < sizeof...(Args); ++z) {
|
||||
VecGetter<V>::get_at(m_wrapped, z + 2) = args[z];
|
||||
assign_values(bt::index_range<2, dimensions>(), std::forward<Args>(parArgs)...);
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
template <std::size_t... I, typename... Args>
|
||||
void VecBase<V>::assign_values (const bt::index_seq<I...>&, Args... parArgs) {
|
||||
static_assert(sizeof...(I) == sizeof...(Args), "Argument count and indices count mismatch");
|
||||
|
||||
std::initializer_list<scalar_type> t {
|
||||
(VecGetter<V>::get_at(m_wrapped, I) = parArgs)...
|
||||
};
|
||||
static_cast<void>(t);
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
|
@ -143,7 +151,7 @@ namespace vwr {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
typename VectorWrapperInfo<T>::scalar_type& VecGetter<T, false>::get_at (T& parVec, std::size_t parIndex) {
|
||||
auto VecGetter<T, false>::get_at (T& parVec, std::size_t parIndex) -> get_at_rettype {
|
||||
assert(parIndex < VectorWrapperInfo<T>::dimensions);
|
||||
return VectorWrapperInfo<T>::get_at(parIndex, parVec);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue