Stan  2.14.0
probability, sampling & optimization
returns_type_def.hpp
Go to the documentation of this file.
1 #ifndef STAN_LANG_AST_FUN_RETURNS_TYPE_DEF_HPP
2 #define STAN_LANG_AST_FUN_RETURNS_TYPE_DEF_HPP
3 
8 #include <boost/variant/apply_visitor.hpp>
9 #include <ostream>
10 
11 namespace stan {
12  namespace lang {
13 
14  bool returns_type(const expr_type& return_type, const statement& statement,
15  std::ostream& error_msgs) {
16  if (return_type == VOID_T)
17  return true;
18  returns_type_vis vis(return_type, error_msgs);
19  return boost::apply_visitor(vis, statement.statement_);
20  }
21 
22  }
23 }
24 #endif
Structure to wrap the variant type of statements.
Definition: statement.hpp:29
Probability, optimization and sampling library.
statement_t statement_
The statement variant type held by this wrapper.
Definition: statement.hpp:194
Structure of the type of an expression, which consists of a base type and a number of dimensions...
Definition: expr_type.hpp:14
Visitor for reporting an error message if the statement is not a return statement with a type specifi...
bool returns_type(const expr_type &return_type, const statement &statement, std::ostream &error_msgs)
Return true if the specified statement is a return statement returning an expression of the specified...
const int VOID_T
Void type.

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