11#ifndef STAN_MATH_PRIM_META_BROADCAST_ARRAY_HPP
22#define STAN_MATH_PRIM_META_BROADCAST_ARRAY_HPP
33
4- #include < stan/math/prim/fun/Eigen.hpp>
54#include < stan/math/prim/meta/require_generics.hpp>
65#include < stan/math/prim/meta/promote_scalar_type.hpp>
7- #include < type_traits>
6+ #include < stan/math/prim/fun/Eigen.hpp>
7+ #include < stdexcept>
88
99namespace stan {
1010namespace math {
@@ -13,16 +13,14 @@ namespace internal {
1313template <typename T>
1414class broadcast_array {
1515 private:
16- using T_decay = std::decay_t <T>;
17- T_decay& prim_;
16+ T& prim_;
1817
1918 public:
2019 explicit broadcast_array (T& prim) : prim_(prim) {}
2120
22- auto & operator [](int /* i*/ ) { return prim_; }
23- const auto & operator [](int /* i*/ ) const { return prim_; }
21+ T& operator [](int /* i*/ ) { return prim_; }
2422
25- /* *
23+ /* * \ingroup type_trait
2624 * We can assign any right hand side which allows for indexing to a
2725 * broadcast_array. The idea is that the entry for the first index is what
2826 * gets assigned. The most common use-case should be where the rhs is some
@@ -32,34 +30,22 @@ class broadcast_array {
3230 void operator =(const Y& m) {
3331 prim_ = m[0 ];
3432 }
35- explicit broadcast_array (const broadcast_array<T>& other) = default;
36- explicit broadcast_array (broadcast_array<T>&& other) = default;
37- broadcast_array& operator =(const broadcast_array& other) = default ;
38- broadcast_array& operator =(broadcast_array&& other) = default ;
3933};
4034
4135template <typename T, typename S, typename Enable = void >
4236class empty_broadcast_array {
4337 public:
44- using T_decay = std::decay_t <T>;
4538 empty_broadcast_array () {}
46- /* *
39+ /* * \ingroup type_trait
4740 * Not implemented so cannot be called.
4841 */
49- T_decay& operator [](int /* i*/ );
50- T_decay& operator [](int /* i*/ ) const ;
42+ T& operator [](int /* i*/ );
5143
52- /* *
44+ /* * \ingroup type_trait
5345 * Not implemented so cannot be called.
5446 */
5547 template <typename Y>
5648 void operator =(const Y& /* A*/ );
57-
58- /* *
59- * Not implemented so cannot be called.
60- */
61- template <typename R>
62- void operator +=(R);
6349};
6450
6551template <typename ViewElt, typename T>
@@ -69,31 +55,31 @@ class empty_broadcast_array<ViewElt, T, require_eigen_t<T>> {
6955
7056 public:
7157 empty_broadcast_array () {}
72- /* *
58+ /* * \ingroup type_trait
7359 * Not implemented so cannot be called.
7460 */
7561 ViewElt& operator [](int /* i*/ );
76- /* *
62+ /* * \ingroup type_trait
7763 * Not implemented so cannot be called.
7864 */
7965 ViewElt& operator ()(int /* i*/ );
80- /* *
66+ /* * \ingroup type_trait
8167 * Not implemented so cannot be called.
8268 */
8369 void operator =(const T_arg& /* A*/ );
84- /* *
70+ /* * \ingroup type_trait
8571 * Not implemented so cannot be called.
8672 */
8773 void operator +=(T_arg /* A*/ );
88- /* *
74+ /* * \ingroup type_trait
8975 * Not implemented so cannot be called.
9076 */
9177 void operator -=(T_arg /* A*/ );
92- /* *
78+ /* * \ingroup type_trait
9379 * Not implemented so cannot be called.
9480 */
9581 T& row (int /* i*/ );
96- /* *
82+ /* * \ingroup type_trait
9783 * Not implemented so cannot be called.
9884 */
9985 T& col (int /* i*/ );
0 commit comments