7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2024-11-24 18:35:02 +00:00
kicad/thirdparty/argparse/test/test_utility.hpp
2023-12-17 21:29:05 -05:00

20 lines
414 B
C++

#ifndef ARGPARSE_TEST_UTILITY_HPP
#define ARGPARSE_TEST_UTILITY_HPP
#include <list>
namespace testutility {
// Get value at index from std::list
template <typename T>
T get_from_list(const std::list<T>& aList, size_t aIndex) {
if (aList.size() > aIndex) {
auto tIterator = aList.begin();
std::advance(tIterator, aIndex);
return *tIterator;
}
return T();
}
}
#endif //ARGPARSE_TEST_UTILITY_HPP