Drake
default_scalars.h File Reference
#include "drake/common/autodiff.h"
#include "drake/common/symbolic.h"
Include dependency graph for default_scalars.h:

Go to the source code of this file.

Macros

#define DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(SomeType)
 A macro that defines explicit class template instantiations for Drake's default set of supported scalar types. More...
 
#define DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_NONSYMBOLIC_SCALARS(SomeType)
 A macro to that defines explicit class template instantiations for Drake's default set of supported scalar types, excluding all symbolic types. More...
 

Macro Definition Documentation

#define DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_NONSYMBOLIC_SCALARS (   SomeType)
Value:
template SomeType<double>; \
template SomeType<::drake::AutoDiffXd>;

A macro to that defines explicit class template instantiations for Drake's default set of supported scalar types, excluding all symbolic types.

This macro should only be used in .cc files, never in .h files. This is identical to DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS except that it does not define support for any drake::symbolic types.

#define DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS (   SomeType)
Value:
SomeType) \
template SomeType<::drake::symbolic::Expression>;
#define DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_NONSYMBOLIC_SCALARS(SomeType)
A macro to that defines explicit class template instantiations for Drake&#39;s default set of supported s...
Definition: default_scalars.h:49

A macro that defines explicit class template instantiations for Drake's default set of supported scalar types.

This macro should only be used in .cc files, never in .h files.

Parameters
SomeTypethe template typename to instantiate, including the leading class or struct keyword.

Currently the supported types are:

Example my_system.h:

1 namespace sample {
2 template <typename T>
3 class MySystem final : public LeafSystem<T> {
4  ...

Example my_system.cc:

1 #include "my_system.h"
2 
3 #include "drake/common/default_scalars.h"
4 
5 DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
6  class ::sample::MySystem)

See also System Scalar Conversion.