VectorBuilderHelper.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_SCAL_META_VECTORBUILDER_HELPER_HPP
#define STAN_MATH_PRIM_SCAL_META_VECTORBUILDER_HELPER_HPP
#include <stan/math/prim/scal/meta/contains_vector.hpp>
#include <stdexcept>
namespace stan {
template<typename T1, bool used, bool is_vec>
class VectorBuilderHelper {
public:
explicit VectorBuilderHelper(size_t /* n */) { }
T1& operator[](size_t /* i */) {
throw std::logic_error("used is false. this should never be called");
}
typedef T1 type;
inline type& data() {
throw std::logic_error("used is false. this should never be called");
}
};
template<typename T1>
class VectorBuilderHelper<T1, true, false> {
private:
T1 x_;
public:
explicit VectorBuilderHelper(size_t /* n */) : x_(0.0) { }
T1& operator[](size_t /* i */) {
return x_;
}
typedef T1 type;
inline type& data() {
return x_;
}
};
}
#endif
stan
Definition: log_sum_exp.hpp:8
stan::VectorBuilderHelper< T1, true, false >::data
type & data()
Definition: VectorBuilderHelper.hpp:52
stan::VectorBuilderHelper::data
type & data()
Definition: VectorBuilderHelper.hpp:35
stan::VectorBuilderHelper::operator[]
T1 & operator[](size_t)
Definition: VectorBuilderHelper.hpp:29
stan::VectorBuilderHelper::type
T1 type
Definition: VectorBuilderHelper.hpp:33
stan::VectorBuilderHelper< T1, true, false >::operator[]
T1 & operator[](size_t)
Definition: VectorBuilderHelper.hpp:46
stan::VectorBuilderHelper
VectorBuilder allocates type T1 values to be used as intermediate values.
Definition: VectorBuilderHelper.hpp:25
contains_vector.hpp
stan::VectorBuilderHelper< T1, true, false >::type
T1 type
Definition: VectorBuilderHelper.hpp:50
stan::VectorBuilderHelper::VectorBuilderHelper
VectorBuilderHelper(size_t)
Definition: VectorBuilderHelper.hpp:27
stan::VectorBuilderHelper< T1, true, false >::VectorBuilderHelper
VectorBuilderHelper(size_t)
Definition: VectorBuilderHelper.hpp:45

[ Stan Home Page ] © 2011–2016, Stan Development Team.