/* *****************************************************
   THIS IS AN AUTOMATICALLY GENERATED FILE. DO NOT EDIT.
   *****************************************************

   Generated by:
     scitbx.source_generators.array_family.generate_apply
 */

#ifndef SCITBX_ARRAY_FAMILY_VERSA_PLAIN_APPLY_H
#define SCITBX_ARRAY_FAMILY_VERSA_PLAIN_APPLY_H

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include <scitbx/type_holder.h>
#include <scitbx/array_family/versa_plain.h>
#include <scitbx/array_family/detail/generic_array_functors.h>

namespace scitbx { namespace af {

  template<
    typename UnaryOperation, typename ElementType,
    typename AccessorType, typename ReturnElementType>
  inline
  versa_plain<ReturnElementType, AccessorType>
  apply(UnaryOperation const& op,
        versa_plain<ElementType, AccessorType> const& a,
        type_holder<ReturnElementType> /*result_type_holder*/) {
    typedef versa_plain<ReturnElementType, AccessorType> return_array_type;
    return return_array_type(a.accessor(),
      make_init_functor(
        array_functor_a<UnaryOperation, ElementType, ReturnElementType>(
          op, a.begin())));
  }

  template<
    typename UnaryOperation, typename ElementType, typename AccessorType>
  inline
  versa_plain<typename UnaryOperation::result_type, AccessorType>
  apply(UnaryOperation const& op,
        versa_plain<ElementType, AccessorType> const& a) {
    return apply(op, a, type_holder<typename UnaryOperation::result_type>());
  }

}} // namespace scitbx::af

#endif // DOXYGEN_SHOULD_SKIP_THIS

#endif // SCITBX_ARRAY_FAMILY_VERSA_PLAIN_APPLY_H
