>::type
vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
{
- difference_type __n = _VSTD::distance(__first, __last);
+ const difference_type __n_signed = _VSTD::distance(__first, __last);
+ _LIBCPP_ASSERT(__n_signed >= 0, "invalid range specified");
+ const size_type __n = static_cast<size_type>(__n_signed);
iterator __r;
size_type __c = capacity();
if (__n <= __c && size() <= __c - __n)
#include <__config>
#include <experimental/dynarray>
+#include <cstddef>
#include <cassert>
#include <algorithm>
assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
- assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
- assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
- assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
- assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+ std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
+ assert (ds == std::distance ( dyn.begin(), dyn.end()));
+ assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
+ assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
+ assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
assert ( dyn.begin () == dyn.cbegin ());
assert ( &*dyn.begin () == &*dyn.cbegin ());
assert ( data + dyn.size() - 1 == &*dyn.rbegin ());
assert ( data + dyn.size() - 1 == &*dyn.crbegin ());
- assert ( dyn.size () == std::distance ( dyn.begin(), dyn.end()));
- assert ( dyn.size () == std::distance ( dyn.cbegin(), dyn.cend()));
- assert ( dyn.size () == std::distance ( dyn.rbegin(), dyn.rend()));
- assert ( dyn.size () == std::distance ( dyn.crbegin(), dyn.crend()));
+ std::ptrdiff_t ds = static_cast<std::ptrdiff_t>(dyn.size());
+ assert (ds == std::distance ( dyn.begin(), dyn.end()));
+ assert (ds == std::distance ( dyn.cbegin(), dyn.cend()));
+ assert (ds == std::distance ( dyn.rbegin(), dyn.rend()));
+ assert (ds == std::distance ( dyn.crbegin(), dyn.crend()));
assert ( dyn.begin () == dyn.cbegin ());
assert ( &*dyn.begin () == &*dyn.cbegin ());
self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
+ # These warnings should be enabled in order to support the MSVC
+ # team using the test suite; They enable the warnings below and
+ # expect the test suite to be clean.
+ self.cxx.addWarningFlagIfSupported('-Wsign-compare')
+ # FIXME: Enable the two warnings below.
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
+ self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
# TODO(EricWF) Remove the unused warnings once the test suite
# compiles clean with them.
- self.cxx.addWarningFlagIfSupported('-Wno-sign-compare')
self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
- self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
- self.cxx.addWarningFlagIfSupported('-Wno-unused-parameter')
std = self.get_lit_conf('std', None)
if std in ['c++98', 'c++03']:
# The '#define static_assert' provided by libc++ in C++03 mode
#include <algorithm>
#include <functional>
+#include <cstddef>
#include <cassert>
#include "test_iterators.h"
#include "counting_predicates.hpp"
-struct is_odd
-{
- bool operator()(const int& i) const {return i & 1;}
+struct is_odd {
+ bool operator()(const int &i) const { return i & 1; }
};
-int main()
-{
- {
- const int ia[] = {1, 2, 3, 4, 5, 6};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {2, 4, 6, 1, 3, 5};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6, 7};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert(!std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 2, 4, 6, 7};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::begin(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::begin(ia)));
- }
- {
- const int ia[] = {1, 3, 5, 7, 9, 11, 2};
- unary_counting_predicate<is_odd, int> pred((is_odd()));
- assert( std::is_partitioned(input_iterator<const int*>(std::begin(ia)),
- input_iterator<const int*>(std::end(ia)),
- std::ref(pred)));
- assert(pred.count() <= std::distance(std::begin(ia), std::end(ia)));
- }
+int main() {
+ {
+ const int ia[] = {1, 2, 3, 4, 5, 6};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {2, 4, 6, 1, 3, 5};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6, 7};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(!std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 2, 4, 6, 7};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::begin(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::begin(ia)));
+ }
+ {
+ const int ia[] = {1, 3, 5, 7, 9, 11, 2};
+ unary_counting_predicate<is_odd, int> pred((is_odd()));
+ assert(std::is_partitioned(input_iterator<const int *>(std::begin(ia)),
+ input_iterator<const int *>(std::end(ia)),
+ std::ref(pred)));
+ assert(static_cast<std::ptrdiff_t>(pred.count()) <=
+ std::distance(std::begin(ia), std::end(ia)));
+ }
}
#include <algorithm>
#include <cassert>
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#include <memory>
-#endif
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
test()
{
int ia[] = {0};
- const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0]));
Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia));
assert(base(r) == ia);
assert(ia[0] == 0);
assert(ia[0] == 0);
int ib[] = {0, 1};
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0]));
r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb));
assert(base(r) == ib+sb);
assert(ib[0] == 0);
assert(ib[1] == 0);
int ic[] = {0, 1, 2};
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0]));
r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc));
assert(base(r) == ic+sc);
assert(ic[0] == 0);
assert(ic[2] == 2);
int id[] = {0, 1, 2, 3};
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const int sd = static_cast<int>(sizeof(id)/sizeof(id[0]));
r = std::rotate(Iter(id), Iter(id), Iter(id+sd));
assert(base(r) == id+sd);
assert(id[0] == 0);
assert(id[3] == 1);
int ie[] = {0, 1, 2, 3, 4};
- const unsigned se = sizeof(ie)/sizeof(ie[0]);
+ const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0]));
r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se));
assert(base(r) == ie+se);
assert(ie[0] == 0);
assert(ie[4] == 4);
int ig[] = {0, 1, 2, 3, 4, 5};
- const unsigned sg = sizeof(ig)/sizeof(ig[0]);
+ const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0]));
r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg));
assert(base(r) == ig+sg);
assert(ig[0] == 0);
assert(ig[5] == 2);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
template <class Iter>
void
test1()
{
std::unique_ptr<int> ia[1];
- const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+ const int sa = static_cast<int>(sizeof(ia)/sizeof(ia[0]));
for (int i = 0; i < sa; ++i)
ia[i].reset(new int(i));
Iter r = std::rotate(Iter(ia), Iter(ia), Iter(ia));
assert(*ia[0] == 0);
std::unique_ptr<int> ib[2];
- const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+ const int sb = static_cast<int>(sizeof(ib)/sizeof(ib[0]));
for (int i = 0; i < sb; ++i)
ib[i].reset(new int(i));
r = std::rotate(Iter(ib), Iter(ib), Iter(ib+sb));
assert(*ib[1] == 0);
std::unique_ptr<int> ic[3];
- const unsigned sc = sizeof(ic)/sizeof(ic[0]);
+ const int sc = static_cast<int>(sizeof(ic)/sizeof(ic[0]));
for (int i = 0; i < sc; ++i)
ic[i].reset(new int(i));
r = std::rotate(Iter(ic), Iter(ic), Iter(ic+sc));
assert(*ic[2] == 2);
std::unique_ptr<int> id[4];
- const unsigned sd = sizeof(id)/sizeof(id[0]);
+ const int sd = static_cast<int>(sizeof(id)/sizeof(id[0]));
for (int i = 0; i < sd; ++i)
id[i].reset(new int(i));
r = std::rotate(Iter(id), Iter(id), Iter(id+sd));
assert(*id[3] == 1);
std::unique_ptr<int> ie[5];
- const unsigned se = sizeof(ie)/sizeof(ie[0]);
+ const int se = static_cast<int>(sizeof(ie)/sizeof(ie[0]));
for (int i = 0; i < se; ++i)
ie[i].reset(new int(i));
r = std::rotate(Iter(ie), Iter(ie), Iter(ie+se));
assert(*ie[4] == 4);
std::unique_ptr<int> ig[6];
- const unsigned sg = sizeof(ig)/sizeof(ig[0]);
+ const int sg = static_cast<int>(sizeof(ig)/sizeof(ig[0]));
for (int i = 0; i < sg; ++i)
ig[i].reset(new int(i));
r = std::rotate(Iter(ig), Iter(ig), Iter(ig+sg));
assert(*ig[5] == 2);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // TEST_STD_VER >= 11
int main()
{
test<random_access_iterator<int*> >();
test<int*>();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
test1<forward_iterator<std::unique_ptr<int>*> >();
test1<bidirectional_iterator<std::unique_ptr<int>*> >();
test1<random_access_iterator<std::unique_ptr<int>*> >();
test1<std::unique_ptr<int>*>();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
test()
{
const unsigned N = 1000;
- const unsigned M = 10;
+ const int M = 10;
std::vector<int> v(N);
int x = 0;
for (std::size_t i = 0; i < v.size(); ++i)
#include <algorithm>
#include <functional>
+#include <memory>
#include <cassert>
+#include "test_macros.h"
#include "counting_predicates.hpp"
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#include <memory>
-
struct indirect_less
{
template <class P>
{return *x < *y;}
};
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void test(unsigned N)
+void test(int N)
{
int* ia = new int [N];
{
for (int i = 0; i < N; ++i)
ia[i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
for (int i = 0; i < N; ++i)
ia[N-1-i] = i;
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
binary_counting_predicate<std::greater<int>, int, int> pred ((std::greater<int>()));
std::random_shuffle(ia, ia+N);
std::make_heap(ia, ia+N, std::ref(pred));
- assert(pred.count() <= 3*N);
+ assert(pred.count() <= 3u*N);
assert(std::is_heap(ia, ia+N, pred));
}
test(10000);
test(100000);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if TEST_STD_VER >= 11
{
const int N = 1000;
std::unique_ptr<int>* ia = new std::unique_ptr<int> [N];
assert(std::is_heap(ia, ia+N, indirect_less()));
delete [] ia;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
}
std::inplace_merge(Iter(ia), Iter(ia+M), Iter(ia+N), std::ref(pred));
if(N > 0)
{
- assert(ia[0] == N-1);
+ assert(ia[0] == static_cast<int>(N)-1);
assert(ia[N-1] == 0);
assert(std::is_sorted(ia, ia+N, std::greater<value_type>()));
assert(pred.count() <= (N-1));
test<S*>();
{
- unsigned N = 100;
+ int N = 100;
unsigned M = 50;
std::unique_ptr<int>* ia = new std::unique_ptr<int>[N];
- for (unsigned i = 0; i < N; ++i)
+ for (int i = 0; i < N; ++i)
ia[i].reset(new int(i));
std::random_shuffle(ia, ia+N);
std::sort(ia, ia+M, indirect_less());
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
void test_eq()
{
- const size_t N = 10;
+ const int N = 10;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 10; // all the same
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
#include <functional>
#include <cassert>
+#include "test_macros.h"
#include "test_iterators.h"
template <class Iter>
test<Iter>(10);
test<Iter>(1000);
{
- const unsigned N = 100;
+ const int N = 100;
int* a = new int[N];
for (int i = 0; i < N; ++i)
a[i] = 5;
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
test_sort_driver_driver(f, l, start, l);
}
-template <unsigned sa>
+template <int sa>
void
test_sort_()
{
// template <class... Args> reference emplace_back(Args&&... args);
#include <deque>
+#include <cstddef>
#include <cassert>
+#include "test_macros.h"
#include "../../../Emplaceable.h"
#include "min_allocator.h"
#include "test_allocator.h"
std::size_t c1_osize = c1.size();
Ref ref = c1.emplace_back(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(distance(c1.begin(), c1.end())
+ == static_cast<std::ptrdiff_t>(c1.size()));
I i = c1.end();
assert(*--i == Emplaceable(1, 2.5));
assert(&(*i) == &ref);
// template <class... Args> reference emplace_front(Args&&... args);
#include <deque>
+#include <cstddef>
#include <cassert>
+#include "test_macros.h"
#include "../../../Emplaceable.h"
#include "min_allocator.h"
std::size_t c1_osize = c1.size();
Ref res_ref = c1.emplace_front(Emplaceable(1, 2.5));
assert(c1.size() == c1_osize + 1);
- assert(distance(c1.begin(), c1.end()) == c1.size());
+ assert(distance(c1.begin(), c1.end())
+ == static_cast<std::ptrdiff_t>(c1.size()));
I i = c1.begin();
assert(*i == Emplaceable(1, 2.5));
assert(&res_ref == &(*i));
#include <vector>
#include <cassert>
#include <cstddef>
+
+#include "test_macros.h"
#include "test_iterators.h"
#include "min_allocator.h"
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
#include <vector>
#include <cassert>
#include <cstddef>
+#include "test_macros.h"
#include "test_allocator.h"
#include "test_iterators.h"
#include "min_allocator.h"
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
std::size_t j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < v.size(); ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
int j;
for (j = 0; j < 10; ++j)
assert(v[j] == 0);
- for (int k = 0; k < N; ++j, ++k)
+ for (std::size_t k = 0; k < N; ++j, ++k)
assert(v[j] == a[k]);
for (; j < 105; ++j)
assert(v[j] == 0);
#include "test_macros.h"
void
-test(int i)
+test(std::size_t i)
{
typedef std::error_code T;
typedef std::hash<T> H;
#include "test_macros.h"
void
-test(int i)
+test(std::size_t i)
{
typedef std::error_condition T;
typedef std::hash<T> H;
#include <experimental/filesystem>
#include <type_traits>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
{
struct FileInfo {
path filename;
- int size;
+ std::size_t size;
};
const FileInfo files[] = {
{"file1", 0},
// constexpr const_iterator end() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
assert(ce2 != s.begin());
}
- assert( e - s.begin() == s.size());
- assert(ce1 - cs.begin() == cs.size());
- assert(ce2 - s.cbegin() == s.size());
+ assert( e - s.begin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.begin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.cbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
// constexpr const_iterator rend() const;
#include <experimental/string_view>
+#include <cstddef>
#include <cassert>
#include "test_macros.h"
assert(ce2 != s.rbegin());
}
- assert( e - s.rbegin() == s.size());
- assert(ce1 - cs.rbegin() == cs.size());
- assert(ce2 - s.crbegin() == s.size());
+ assert( e - s.rbegin() == static_cast<std::ptrdiff_t>(s.size()));
+ assert(ce1 - cs.rbegin() == static_cast<std::ptrdiff_t>(cs.size()));
+ assert(ce2 - s.crbegin() == static_cast<std::ptrdiff_t>(s.size()));
assert( e == ce1);
assert( e == ce2);
// This test is not entirely portable
#include <fstream>
+#include <cstddef>
#include <cassert>
#include "platform_support.h" // locale name macros
assert(f.sbumpc() == 0x4E51);
assert(f.sbumpc() == 0x4E52);
assert(f.sbumpc() == 0x4E53);
- assert(f.sbumpc() == -1);
+ assert(f.sbumpc() == static_cast<unsigned>(-1));
}
}
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
- assert(to[i] == from[i]);
+ assert(to[i] == static_cast<char32_t>(from[i]));
}
assert(from_next - from == 9);
assert(to_next - to == 9);
for (unsigned i = 0; i < 9; ++i)
- assert(to[i] == from[i]);
+ assert(static_cast<char32_t>(to[i]) == from[i]);
}
}
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err == ios.goodbit);
- assert(v == 0x8000000000000000LL);
+ const long long expect = 0x8000000000000000LL;
+ assert(v == expect);
}
}
T a[] = {5, 4, 3, 2, 1};
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i] == a[i]);
v[i] = i;
- assert(v[i] == i);
+ assert(v[i] == static_cast<int>(i));
}
}
}
T a[] = {5, 4, 3, 2, 1};
const unsigned N = sizeof(a)/sizeof(a[0]);
const std::valarray<T> v(a, N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i] == a[i]);
}
std::valarray<T> v2(a, N-2);
v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
std::valarray<T> v2(a, N-2);
v2 = {T(1), T(2), T(3), T(4), T(5)};
assert(v2.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
for (std::size_t j = 0; j < a[i].size(); ++j)
v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
for (std::size_t j = 0; j < a[i].size(); ++j)
std::valarray<T> v(a, N);
std::valarray<T> v2 = v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v = {1, 2, 3, 4, 5};
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v = {1, 2, 3, 4, 5};
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
std::valarray<T> v2 = std::move(v);
assert(v2.size() == N);
assert(v.size() == 0);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == a[i].size());
for (std::size_t j = 0; j < v2[i].size(); ++j)
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
assert(v[i] == a[i]);
}
{
const unsigned N = sizeof(a)/sizeof(a[0]);
std::valarray<T> v(a, N);
assert(v.size() == N);
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v[i].size() == a[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
std::valarray<T> v(a, N);
std::valarray<T> v2 = ~v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
std::valarray<T> v(a, N);
std::valarray<T> v2 = -v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
std::valarray<T> v(a, N);
std::valarray<T> v2 = +v;
assert(v2.size() == v.size());
- for (int i = 0; i < N; ++i)
+ for (unsigned i = 0; i < N; ++i)
{
assert(v2[i].size() == v[i].size());
for (std::size_t j = 0; j < v[i].size(); ++j)
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
std::binomial_distribution<> dist1(5, 0.1);
std::binomial_distribution<unsigned> dist2(5, 0.1);
- for(int i = 0; i < N; ++i)
- assert(dist1(gen1) == dist2(gen2));
+ for(int i = 0; i < N; ++i) {
+ int r1 = dist1(gen1);
+ unsigned r2 = dist2(gen2);
+ assert(r1 >= 0);
+ assert(static_cast<unsigned>(r1) == r2);
+ }
}
void
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
double var = 0;
double skew = 0;
double kurtosis = 0;
- for (int i = 0; i < u.size(); ++i)
+ for (unsigned i = 0; i < u.size(); ++i)
{
double dbl = (u[i] - mean);
double d2 = sqr(dbl);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
}
std::vector<double> prob(std::begin(p), std::end(p));
double s = std::accumulate(prob.begin(), prob.end(), 0.0);
- for (int i = 0; i < prob.size(); ++i)
+ for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
for (std::size_t i = 0; i < prob.size(); ++i)
prob[i] /= s;
std::sort(u.begin(), u.end());
- for (int i = 0; i < Np; ++i)
+ for (std::size_t i = 0; i < Np; ++i)
{
typedef std::vector<D::result_type>::iterator I;
I lb = std::lower_bound(u.begin(), u.end(), b[i]);
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
double p[] = {1, 0, 0, 0};
const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
D d(b, b+Np+1, p);
- const int N = 1000000;
+ const size_t N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
a = 0;
for (int j = 0; j < k; ++j)
a += areas[j];
- assert(k < Np);
+ assert(k < static_cast<int>(Np));
m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
bk = b[k];
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
assert(i < Np);
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
a = 0;
for (int j = 0; j < k; ++j)
a += areas[j];
- assert(k < Np);
+ assert(k < static_cast<int>(Np));
m = (p[k+1] - p[k]) / (b[k+1] - b[k]);
bk = b[k];
c = (b[k+1]*p[k] - b[k]*p[k+1]) / (b[k+1] - b[k]);
D d(b, b+Np+1, p);
const int N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g);
assert(d.min() <= v && v < d.max());
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
const size_t Np = sizeof(p) / sizeof(p[0]) - 1;
D d;
P pa(b, b+Np+1, p);
- const int N = 1000000;
+ const size_t N = 1000000;
std::vector<D::result_type> u;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
D::result_type v = d(g, pa);
assert(10 <= v && v < 17);
double c = std::numeric_limits<double>::quiet_NaN();
std::vector<double> areas(Np);
double S = 0;
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
{
areas[i] = (p[i]+p[i+1])*(b[i+1]-b[i])/2;
S += areas[i];
}
- for (int i = 0; i < areas.size(); ++i)
+ for (size_t i = 0; i < areas.size(); ++i)
areas[i] /= S;
- for (int i = 0; i < Np+1; ++i)
+ for (size_t i = 0; i < Np+1; ++i)
p[i] /= S;
- for (int i = 0; i < N; ++i)
+ for (size_t i = 0; i < N; ++i)
{
int k = std::lower_bound(b, b+Np+1, u[i]) - b - 1;
if (k != kp)
#endif
std::vector<std::shared_ptr<T> > pointers;
const std::size_t test_size = 100;
- for (int i=0; i < test_size; ++i)
+ for (size_t i=0; i < test_size; ++i)
pointers.push_back(std::shared_ptr<T>(new T()));
Compare comp;
UIntCompare ucomp;
VoidCompare vcomp;
- for (int i=0; i < test_size; ++i) {
- for (int j=0; j < test_size; ++j) {
+ for (size_t i=0; i < test_size; ++i) {
+ for (size_t j=0; j < test_size; ++j) {
T* lhs = pointers[i].get();
T* rhs = pointers[j].get();
std::uintptr_t lhs_uint = reinterpret_cast<std::uintptr_t>(lhs);
if (sizeof(T) <= sizeof(std::size_t))
{
const std::size_t result = h(t);
- LIBCPP_ASSERT(result == t);
+ LIBCPP_ASSERT(result == static_cast<size_t>(t));
((void)result); // Prevent unused warning
}
}