Skip to content

Commit

Permalink
using std::any_of()
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinRayAngus committed Aug 30, 2024
1 parent 1b4b913 commit 6f306bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/FieldSolver/Fields.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef WARPX_FIELDS_H_
#define WARPX_FIELDS_H_

#include <algorithm>

namespace warpx::fields
{
enum struct FieldType : int
Expand Down Expand Up @@ -45,13 +47,11 @@ namespace warpx::fields
FieldType::Efield_cp, FieldType::Bfield_cp, FieldType::current_cp,
FieldType::Efield_avg_fp, FieldType::Bfield_avg_fp, FieldType::Efield_avg_cp, FieldType::Bfield_avg_cp};

constexpr bool
inline bool
isFieldArray (const FieldType field_type)
{
for (const auto& f : ArrayFieldTypes) {
if (f == field_type) { return true; }
}
return false;
return std::any_of( std::begin(ArrayFieldTypes), std::end(ArrayFieldTypes),
[field_type](const FieldType& f) { return f == field_type; });
}

}
Expand Down

0 comments on commit 6f306bd

Please sign in to comment.