diff --git a/Control/CxxUtils/CMakeLists.txt b/Control/CxxUtils/CMakeLists.txt index a25d52dd4009f46f5b7a87581280d784207a32c5..0b72e6c1ec57b67f1ca47ef3b51c025101b5c5f8 100644 --- a/Control/CxxUtils/CMakeLists.txt +++ b/Control/CxxUtils/CMakeLists.txt @@ -103,7 +103,7 @@ atlas_add_test( exctrace2_test LOG_IGNORE_PATTERN "no version information available" ) # Set up the "simple" tests: -foreach( test sincos_test copyif_test ArrayScanner_test Arrayrep_test +foreach( test sincos_test ArrayScanner_test Arrayrep_test Array_test PackedArray_test pointer_list_test FloatPacker_test fpcompare_test StrFormat_test phihelper_test prefetch_test ClassName_test ones_test diff --git a/Control/CxxUtils/CxxUtils/algorithms.h b/Control/CxxUtils/CxxUtils/algorithms.h deleted file mode 100644 index 0e8a37df41320684e1dd1728c6587287d01c5775..0000000000000000000000000000000000000000 --- a/Control/CxxUtils/CxxUtils/algorithms.h +++ /dev/null @@ -1,55 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// algorithms.h -// Header file for CxxUtils::copy_if - copied from gcc4.4 -// Author: S.Binet<binet@cern.ch> -/////////////////////////////////////////////////////////////////// -#ifndef CXXUTILS_ALGORITHMS_H -#define CXXUTILS_ALGORITHMS_H - -/** - * @brief Copy the elements of a sequence for which a predicate is true. - * @ingroup mutating_algorithms - * @param first An input iterator. - * @param last An input iterator. - * @param result An output iterator. - * @param pred A predicate. - * @return An iterator designating the end of the resulting sequence. - * - * Copies each element in the range @p [first,last) for which - * @p pred returns true to the range beginning at @p result. - * - * copy_if() is stable, so the relative order of elements that are - * copied is unchanged. - * - * <i>Example</i>: - * @code - * CxxUtils::copy_if( in.begin(), in.end(), - * std::back_inserter(out), filter ); - * @endcode - * where in and out are STL-like containers and filter is a predicate - */ - -namespace CxxUtils { - -template<typename InputIterator, typename OutputIterator, - typename Predicate> -OutputIterator -copy_if(InputIterator first, InputIterator last, - OutputIterator result, Predicate pred) -{ - for (; first != last; ++first) - if (pred(*first)) { - *result = *first; - ++result; - } - return result; -} - -}//> end CxxUtils namespace - -#endif //> CXXUTILS_ALGORITHMS_H diff --git a/Control/CxxUtils/test/copyif_test.cxx b/Control/CxxUtils/test/copyif_test.cxx deleted file mode 100644 index fd1a5c4640a14b7497f89b136bf961df17fa807d..0000000000000000000000000000000000000000 --- a/Control/CxxUtils/test/copyif_test.cxx +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: copyif_test.cxx,v 1.1 2009-03-11 11:06:46 binet Exp $ -/** - * @file CxxUtils/test/copyif_test.cxx - * @author Sebastien Binet - * @date March 2009 - * @brief Regression tests for copy_if - */ - - -#undef NDEBUG - - -#include "CxxUtils/algorithms.h" -#include <cassert> -#include <vector> -#include <algorithm> - -using namespace std; - -namespace { - const std::size_t IMAX = 10; -} - -template<typename T> -struct greater_than -{ - T cut; - greater_than(T cut) : cut(cut) {} - - bool - operator()(T x) { return x>cut; } -}; - -void test1() -{ - std::vector<std::size_t> in(IMAX); - for (std::size_t i = 0; i!=IMAX; ++i){ - in[i] = i; - } - for (std::size_t i = 0; i!=IMAX; ++i){ - assert(in[i] == i); - } - - std::vector<std::size_t> out; - CxxUtils::copy_if(in.begin(), in.end(), - std::back_inserter(out), - greater_than<std::size_t>(4)); - assert(out.size()==5); - assert(out[0]==5); - assert(out[1]==6); - assert(out[2]==7); - assert(out[3]==8); - assert(out[4]==9); -} - -void test2() -{ - const std::size_t in[IMAX] = {0, 1,2,3,4,5,6,7,8,9}; - for (std::size_t i = 0; i!=IMAX; ++i){ - assert(in[i] == i); - } - - std::vector<std::size_t> out; - CxxUtils::copy_if(in, in+IMAX, - std::back_inserter(out), - greater_than<std::size_t>(4)); - assert(out.size()==5); - assert(out[0]==5); - assert(out[1]==6); - assert(out[2]==7); - assert(out[3]==8); - assert(out[4]==9); -} - - -int main() -{ - test1(); - test2(); - return 0; -}