Stan  2.14.0
probability, sampling & optimization
arg_decl_def.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_NODE_ARG_DECL_DEF_HPP
2 #define STAN_LANG_AST_NODE_ARG_DECL_DEF_HPP
3 
4 #include <stan/lang/ast.hpp>
5 #include <string>
6 #include <vector>
7 
8 namespace stan {
9  namespace lang {
10 
12 
13  arg_decl::arg_decl(const expr_type& arg_type, const std::string& name)
14  : arg_type_(arg_type), name_(name) { }
15 
17  std::vector<expression> dims;
18  for (size_t i = 0; i < arg_type_.num_dims_; ++i)
19  dims.push_back(expression(int_literal(0))); // dummy value 0
20  return base_var_decl(name_, dims, arg_type_.base_type_);
21  }
22 
23  }
24 }
25 #endif
std::size_t num_dims_
The number of array dimensions.
Definition: expr_type.hpp:23
Probability, optimization and sampling library.
Structure of the type of an expression, which consists of a base type and a number of dimensions...
Definition: expr_type.hpp:14
base_expr_type base_type_
The base expression type.
Definition: expr_type.hpp:18
std::string name_
Name of the argument variable.
Definition: arg_decl.hpp:45
base_var_decl base_variable_declaration() const
Return the base declaration corresponding to this argument declaration.
AST base class for variable declarations, which share most of their structure.
expr_type arg_type_
Type of the argument variable.
Definition: arg_decl.hpp:40
arg_decl()
Construct an uninitialized argument declaration.

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