All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
array_builder.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_FUN_ARRAY_BUILDER_HPP
#define STAN_MATH_PRIM_MAT_FUN_ARRAY_BUILDER_HPP
#include <stan/math/prim/mat/fun/promoter.hpp>
#include <vector>
namespace stan {
namespace math {
template <typename T>
struct array_builder {
std::vector<T> x_;
array_builder() : x_() { }
template <typename F>
array_builder& add(const F& u) {
T t;
promoter<F, T>::promote(u, t);
x_.push_back(t);
return *this;
}
std::vector<T> array() {
return x_;
}
};
}
}
#endif
stan::math::array_builder::x_
std::vector< T > x_
Definition: array_builder.hpp:17
stan::math::array_builder::array
std::vector< T > array()
Definition: array_builder.hpp:26
stan::math::array_builder::add
array_builder & add(const F &u)
Definition: array_builder.hpp:20
stan::math::array_builder::array_builder
array_builder()
Definition: array_builder.hpp:18
promoter.hpp
stan::math::array_builder
Structure for building up arrays in an expression (rather than in statements) using an argumentchaini...
Definition: array_builder.hpp:16
stan::math::promoter::promote
static void promote(const F &u, T &t)
Definition: promoter.hpp:15

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