Stan Math Library  2.20.0
reverse mode automatic differentiation
Public Types | List of all members
stan::return_type< T, Types_pack > Struct Template Reference

Template metaprogram to calculate the base scalar return type resulting from promoting all the scalar types of the template parameters. More...

#include <return_type.hpp>

Public Types

typedef boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
 

Detailed Description

template<typename T, typename... Types_pack>
struct stan::return_type< T, Types_pack >

Template metaprogram to calculate the base scalar return type resulting from promoting all the scalar types of the template parameters.

The metaprogram can take an arbitrary number of template parameters.

All C++ primitive types (except long double) are automatically promoted to double.

return_type<...> is a class defining a single public typedef type that is var if there is a non-constant template argument and is double otherwise. This is consistent with the Stan logic that if code receives var as an input type, then the return type is var. All other functions return double.

Example usage:

Template Parameters
T(required) A type
Types_pack(optional) A parameter pack containing further types.

Definition at line 33 of file return_type.hpp.

Member Typedef Documentation

◆ type

template<typename T, typename... Types_pack>
typedef boost::math::tools::promote_args< double, typename scalar_type<T>::type, typename return_type<Types_pack...>::type>::type stan::return_type< T, Types_pack >::type

Definition at line 36 of file return_type.hpp.


The documentation for this struct was generated from the following file:

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