From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2005-06-27 02:10:32
David Abrahams wrote:
>>As an author of a generic function, how do you know whether to use noalias()
>>or not? The interesting case is where there are one or more parameters
>>that may, or may not, be aliases. The function author cannot know how the
>>user is going to call their function! They would overwise have to write
>>two versions, one that uses noalias() and one that does not, and document
>>which to call.
> Yep, that calls for a noalias view that you can build around any
> vector or matrix before passing it into a generic function.
I fully agree: simple but effective. Generic functions should specify if
they allow the input-arguments to be aliased or not and than it's up to
the user to fullfill all preconditions.