[patch] Remove useless variables, class Gt, and struct CompLast

2015-08-14 Thread Kai Zhao
Hi,

There are some useless variables, class Gt, and struct CompLast in

testsuite/25_algorithms/*

This patch is to remove those useless variables, class Gt and struct
CompLast.

The patch is attached.

commit d13ea592473ccbd29276908782877156e669b28a
Author: Kai Zhao 
Date:   Sat Aug 15 02:23:14 2015 +0800

2015-08-15  Kai Zhao  

testsuite/25_algorithms/nth_element/3.cc: Remove useless variables,
class Gt, and struct CompLast.

testsuite/25_algorithms/partial_sort/2.cc: Likewise.
testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise.
testsuite/25_algorithms/sort/1.cc: Likewise.
testsuite/25_algorithms/stable_sort/2.cc: Likewise.


Thanks,

Kai
commit d13ea592473ccbd29276908782877156e669b28a
Author: Kai Zhao 
Date:   Sat Aug 15 02:23:14 2015 +0800

2015-08-15  Kai Zhao  

testsuite/25_algorithms/nth_element/3.cc: Remove useless variables,
class Gt, and struct CompLast.

testsuite/25_algorithms/partial_sort/2.cc: Likewise.
testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise.
testsuite/25_algorithms/sort/1.cc: Likewise.
testsuite/25_algorithms/stable_sort/2.cc: Likewise.

diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc 
b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
index 29a0450..4f9bc8a 100644
--- a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
@@ -26,8 +26,6 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18,
 const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 
18, 9, 19};
 const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 
3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
-const int logN = 3; // ln(N) rounded up
-const int P = 7;
 
 // comparison predicate for stable_sort: order by rightmost digit
 struct CompLast
@@ -37,28 +35,6 @@ struct CompLast
   { return x % 10 < y % 10; }
 };
 
-// This functor has the equivalent functionality of std::geater<>,
-// but there is no dependency on  and it also tracks the
-// number of invocations since creation.
-class Gt
-{
-public:
-  static int count() { return itsCount; }
-  static void reset() { itsCount = 0; }
-  
-  bool
-  operator()(const int& x, const int& y)
-  {
-++itsCount;
-return x > y; 
-  }
-
-private:
-static int itsCount;
-};
-
-int Gt::itsCount = 0;
-
 // 25.3.2 nth_element()
 void
 test05()
diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc 
b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
index 4ec511a..f68cca5 100644
--- a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
@@ -26,39 +26,19 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18,
 const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 
18, 9, 19};
 const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 
3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
-const int logN = 3; // ln(N) rounded up
 const int P = 7;
 
-// comparison predicate for stable_sort: order by rightmost digit
-struct CompLast
-{
-  bool
-  operator()(const int x, const int y)
-  { return x % 10 < y % 10; }
-};
-
 // This functor has the equivalent functionality of std::geater<>,
 // but there is no dependency on  and it also tracks the
 // number of invocations since creation.
 class Gt
 {
 public:
-  static int count() { return itsCount; }
-  static void reset() { itsCount = 0; }
-  
   bool
   operator()(const int& x, const int& y)
-  {
-++itsCount;
-return x > y; 
-  }
-
-private:
-static int itsCount;
+  { return x > y; }
 };
 
-int Gt::itsCount = 0;
-
 // 25.3.1.3 partial_sort()
 void
 test03()
@@ -71,7 +51,6 @@ test03()
 VERIFY(std::equal(s1, s1 + P, A));
 
 Gt gt;
-gt.reset();
 std::partial_sort(s1, s1 + P, s1 + N, gt);
 VERIFY(std::equal(s1, s1 + P, C));
 }
diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc 
b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc
index 3659666..5943148 100644
--- a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc
@@ -26,40 +26,19 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18,
 const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 
18, 9, 19};
 const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 
3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
-const int logN = 3; // ln(N) rounded up
 const int P = 7;
 
-// comparison predicate for stable_sort: order by rightmost digit
-struct CompLast
-{
-  bool
-  operator()(const int x, const int y)
-  { return x % 10 < y % 10; }
-};
-
 // This functor has the equivalent functionality of std::geater<>,
 // but there is no dependency on  an

Re: [patch] Remove useless variables, class Gt, and struct CompLast

2015-08-15 Thread Kai Zhao
On Sat, Aug 15, 2015 at 2:47 AM, Kai Zhao  wrote:
> Hi,
>
> There are some useless variables, class Gt, and struct CompLast in
>
> testsuite/25_algorithms/*
>
> This patch is to remove those useless variables, class Gt and struct
> CompLast.
>
> The patch is attached.
>
> commit d13ea592473ccbd29276908782877156e669b28a
> Author: Kai Zhao 
> Date:   Sat Aug 15 02:23:14 2015 +0800
>
> 2015-08-15  Kai Zhao  
>
> testsuite/25_algorithms/nth_element/3.cc: Remove useless variables,
> class Gt, and struct CompLast.
>
> testsuite/25_algorithms/partial_sort/2.cc: Likewise.
> testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise.
> testsuite/25_algorithms/sort/1.cc: Likewise.
> testsuite/25_algorithms/stable_sort/2.cc: Likewise.
>

The previous format is wrong, I should add "*" before the changed files.

There are some useless variables, class Gt, and struct CompLast in

testsuite/25_algorithms/*

This patch is to remove those useless variables, class Gt and struct
CompLast.

The patch is attached.

commit d13ea592473ccbd29276908782877156e669b28a
Author: Kai Zhao 
Date:   Sat Aug 15 02:23:14 2015 +0800

2015-08-15  Kai Zhao  

* testsuite/25_algorithms/nth_element/3.cc: Remove useless variables,
class Gt, and struct CompLast.

* testsuite/25_algorithms/partial_sort/2.cc: Likewise.
* testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise.
* testsuite/25_algorithms/sort/1.cc: Likewise.
* testsuite/25_algorithms/stable_sort/2.cc: Likewise.


Thanks,

Kai
commit d13ea592473ccbd29276908782877156e669b28a
Author: Kai Zhao 
Date:   Sat Aug 15 02:23:14 2015 +0800

2015-08-15  Kai Zhao  

* testsuite/25_algorithms/nth_element/3.cc: Remove useless variables,
class Gt, and struct CompLast.

* testsuite/25_algorithms/partial_sort/2.cc: Likewise.
* testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise.
* testsuite/25_algorithms/sort/1.cc: Likewise.
* testsuite/25_algorithms/stable_sort/2.cc: Likewise.

diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc 
b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
index 29a0450..4f9bc8a 100644
--- a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc
@@ -26,8 +26,6 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18,
 const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 
18, 9, 19};
 const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 
3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
-const int logN = 3; // ln(N) rounded up
-const int P = 7;
 
 // comparison predicate for stable_sort: order by rightmost digit
 struct CompLast
@@ -37,28 +35,6 @@ struct CompLast
   { return x % 10 < y % 10; }
 };
 
-// This functor has the equivalent functionality of std::geater<>,
-// but there is no dependency on  and it also tracks the
-// number of invocations since creation.
-class Gt
-{
-public:
-  static int count() { return itsCount; }
-  static void reset() { itsCount = 0; }
-  
-  bool
-  operator()(const int& x, const int& y)
-  {
-++itsCount;
-return x > y; 
-  }
-
-private:
-static int itsCount;
-};
-
-int Gt::itsCount = 0;
-
 // 25.3.2 nth_element()
 void
 test05()
diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc 
b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
index 4ec511a..f68cca5 100644
--- a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc
@@ -26,39 +26,19 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 
14, 15, 16, 17, 18,
 const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 
18, 9, 19};
 const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 
3, 2, 1};
 const int N = sizeof(A) / sizeof(int);
-const int logN = 3; // ln(N) rounded up
 const int P = 7;
 
-// comparison predicate for stable_sort: order by rightmost digit
-struct CompLast
-{
-  bool
-  operator()(const int x, const int y)
-  { return x % 10 < y % 10; }
-};
-
 // This functor has the equivalent functionality of std::geater<>,
 // but there is no dependency on  and it also tracks the
 // number of invocations since creation.
 class Gt
 {
 public:
-  static int count() { return itsCount; }
-  static void reset() { itsCount = 0; }
-  
   bool
   operator()(const int& x, const int& y)
-  {
-++itsCount;
-return x > y; 
-  }
-
-private:
-static int itsCount;
+  { return x > y; }
 };
 
-int Gt::itsCount = 0;
-
 // 25.3.1.3 partial_sort()
 void
 test03()
@@ -71,7 +51,6 @@ test03()
 VERIFY(std::equal(s1, s1 + P, A));
 
 Gt gt;
-gt.reset();
 std::partial_sort(s1, s1 + P, s1 + N, gt);
 VERIFY(std::equal(s1, s1 + P, C));
 }
diff --git a/libstdc++-v3/testsuite/2