Skip to content
Snippets Groups Projects
Commit 06edf6a1 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rename Base/Util/VectorUtil.h -> Base/Util/Vec.h; + indexOfPtr

parent b0d0d294
No related branches found
No related tags found
1 merge request!2370cleanup and prepare refactoring in MasksSet context
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// //
// BornAgain: simulate and fit reflection and scattering // BornAgain: simulate and fit reflection and scattering
// //
//! @file Base/Util/VectorUtil.h //! @file Base/Util/Vec.h
//! @brief Defines namespace VectorUtil. //! @brief Defines namespace Vec.
//! //!
//! @homepage http://www.bornagainproject.org //! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING) //! @license GNU General Public License v3 or higher (see COPYING)
...@@ -12,13 +12,21 @@ ...@@ -12,13 +12,21 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_BASE_UTIL_VECTORUTIL_H #ifndef BORNAGAIN_BASE_UTIL_VEC_H
#define BORNAGAIN_BASE_UTIL_VECTORUTIL_H #define BORNAGAIN_BASE_UTIL_VEC_H
#include <vector> #include <vector>
namespace VectorUtil { namespace Vec {
} // namespace VectorUtil template <class T, class S> int indexOfPtr(const T* t, const std::vector<S*>& v)
{
for (size_t i = 0; i < v.size(); i++)
if (v[i] == t)
return int(i);
return -1;
}
#endif // BORNAGAIN_BASE_UTIL_VECTORUTIL_H } // namespace Vec
#endif // BORNAGAIN_BASE_UTIL_VEC_H
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file Base/Util/VectorUtil.cpp
//! @brief Implements namespace VectorUtil.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "Base/Util/VectorUtil.h"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment