ex subs(const lst & ls, const lst & lr, bool no_pattern = false) const;
protected:
bool is_equal_same_type(const basic & other) const;
- unsigned return_type(void) const;
// new virtual functions which can be overridden by derived classes
public:
return true;
}
-unsigned ${CONTAINER}::return_type(void) const
-{
- return return_types::noncommutative_composite;
-}
-
//////////
// new virtual functions which can be overridden by derived classes
//////////
return *this;
}
-
function_options & function_options::set_return_type(unsigned rt, unsigned rtt)
{
use_return_type = true;
unsigned function::return_type(void) const
{
- if (seq.empty())
- return return_types::commutative;
- else
- return seq.begin()->return_type();
+ const function_options &opt = registered_functions()[serial];
+
+ if (opt.use_return_type) {
+ // Return type was explicitly specified
+ return opt.return_type;
+ } else {
+ // Default behavior is to use the return type of the first
+ // argument. Thus, exp() of a matrix behaves like a matrix, etc.
+ if (seq.empty())
+ return return_types::commutative;
+ else
+ return seq.begin()->return_type();
+ }
}
unsigned function::return_type_tinfo(void) const
{
- if (seq.empty())
- return tinfo_key;
- else
- return seq.begin()->return_type_tinfo();
+ const function_options &opt = registered_functions()[serial];
+
+ if (opt.use_return_type) {
+ // Return type was explicitly specified
+ return opt.return_type_tinfo;
+ } else {
+ // Default behavior is to use the return type of the first
+ // argument. Thus, exp() of a matrix behaves like a matrix, etc.
+ if (seq.empty())
+ return tinfo_key;
+ else
+ return seq.begin()->return_type_tinfo();
+ }
}
//////////