Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed stable_sort and sort order #11

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f79dbac
Whitespace cleanup from upstream.
rpavlik Jun 15, 2012
0cf7b1e
valarray fixes from upstream
rpavlik Jun 15, 2012
0772aea
unwind-cxx changes from upstream
rpavlik Jun 15, 2012
251cdbe
string compile fixes from upstream
rpavlik Jun 15, 2012
e52df93
IOS fixes from upstream
rpavlik Jun 15, 2012
35fa60e
istream_helpers fixes from upstream
rpavlik Jun 15, 2012
e1e3514
Fix typo'd comment
rpavlik Jun 15, 2012
86b3b38
fstream compile fixes from upstream
rpavlik Jun 15, 2012
7e72688
bitset fixes from upstream
rpavlik Jun 15, 2012
b46ae01
associative_base compile fixes from upstream
rpavlik Jun 15, 2012
53e44e2
Clean up and sync cmath
rpavlik Jun 15, 2012
1cff3a1
This shouldn't be necessary with proper protection on fstream.cpp
rpavlik Jun 15, 2012
1c85e80
ostream_helpers cleanup and improve conditional compilation
rpavlik Jun 15, 2012
0c974c0
Updated system_configuration.h
rpavlik Jun 15, 2012
44ab141
My improvements to limits
rpavlik Jun 15, 2012
cc0489b
Actually we do want cmath for AVR
rpavlik Jun 15, 2012
cbc65c4
Handle signaling nans
rpavlik Jun 15, 2012
93cbfc0
Handle other value inquiry functions and clean up comments.
rpavlik Jun 15, 2012
4436604
CMath: Handle older version of libc-avr (like the one included with a…
rpavlik Jun 27, 2012
74b49dc
AVR-libc doesn't have a concept of file.
rpavlik Jun 28, 2012
80fb635
change an ARDUINO check to an __AVR__ check
rpavlik Jun 28, 2012
10a00de
Be sure to grab c math functions from root namespace.
rpavlik Jul 5, 2012
bf88051
Handle pointer types to modf to fix build.
rpavlik Jul 5, 2012
b849d2e
Codespell.
rpavlik Aug 23, 2012
2dc951c
Fix cstdlib on arduino
rpavlik Aug 30, 2012
5d69a9e
Change the name back to <utility> - the warning is an arduino bug.
rpavlik Aug 30, 2012
d807322
Fix min and max
rpavlik Sep 18, 2012
8751ac6
fixed stable_sort and sort order
hariseldon78 Jan 19, 2015
7d54871
string functions
hariseldon78 Jan 23, 2015
f8a7b5f
removed extraneous files
hariseldon78 Feb 10, 2015
2f75be4
Merge branch 'rpavlik'
hariseldon78 Feb 10, 2015
3dc5e5a
fix arduino compilation
hariseldon78 Feb 11, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <cstdlib>
#include <iterator>
#include <utility.h>
#include <utility>
#include <functional>

#ifndef __STD_HEADER_ALGORITHM
Expand Down Expand Up @@ -120,14 +120,14 @@ namespace std{
}
++temp2;
}

}
return last1;
}

template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate> _UCXXEXPORT
ForwardIterator1
find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
find_first_of(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred)
{
Expand All @@ -139,7 +139,7 @@ namespace std{
}
++temp2;
}

}
return last1;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ namespace std{
}

template<class InputIterator1, class InputIterator2> _UCXXEXPORT
pair<InputIterator1, InputIterator2>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2)
{
while(first1 != last1){
Expand Down Expand Up @@ -274,7 +274,7 @@ namespace std{
ForwardIterator2 first2, ForwardIterator2 last2)
{
equal_to<typename iterator_traits<ForwardIterator1>::value_type> c;
return search(first1, last1, first2, last2, c);
return search(first1, last1, first2, last2, c);
}


Expand Down Expand Up @@ -322,7 +322,7 @@ namespace std{
}
++first;
}
return first;
return first;
}


Expand All @@ -346,7 +346,7 @@ namespace std{
}
++first;
}
return first;
return first;

}

Expand Down Expand Up @@ -810,7 +810,7 @@ namespace std{
}
}

//Rotate the element back to the begining
//Rotate the element back to the beginning
tempb = tempe;
while(tempb != first){
iter_swap(tempb, tempb-1 );
Expand All @@ -830,12 +830,6 @@ namespace std{
sort(first, last, c );
}

template<class RandomAccessIterator, class Compare> _UCXXEXPORT
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
{
stable_sort(first, last, comp);
}

template<class RandomAccessIterator> _UCXXEXPORT
void stable_sort(RandomAccessIterator first, RandomAccessIterator last)
{
Expand All @@ -861,6 +855,12 @@ namespace std{
}
}

template<class RandomAccessIterator, class Compare> _UCXXEXPORT
void sort(RandomAccessIterator first, RandomAccessIterator last, Compare comp)
{
stable_sort(first, last, comp);
}

template<class RandomAccessIterator> _UCXXEXPORT
void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, RandomAccessIterator last)
{
Expand Down Expand Up @@ -965,7 +965,7 @@ namespace std{
return last;
}

//Now begin the actual search for the begining
//Now begin the actual search for the beginning
while( distance(first, last) > 1 ){
//Find middle
middle = first;
Expand All @@ -976,7 +976,7 @@ namespace std{
first = middle;
}
}

if( !comp(*first, value) ){
return first;
}
Expand Down Expand Up @@ -1024,7 +1024,7 @@ namespace std{
first = middle;
}
}

if( comp(value, *first) ){
return first;
}
Expand Down Expand Up @@ -1084,10 +1084,10 @@ namespace std{

if( !comp(*first, value) && !comp(value, *first) ){
return true;
}
}
if( !comp(*last, value) && !comp(value, *last) ){
return true;
}
}

return false;
}
Expand Down Expand Up @@ -1301,7 +1301,7 @@ namespace std{
while( first2 != last2 && !comp( *temp, *first2) ){
++first2;
}

}else{ //They are identical - skip
//Elliminate duplicates
InputIterator1 temp = first1;
Expand Down Expand Up @@ -1356,7 +1356,7 @@ namespace std{
while( first2 != last2 && !comp( *temp, *first2) ){
++first2;
}

}else{ //They are identical - skip
//Elliminate duplicates
InputIterator1 temp = first1;
Expand Down Expand Up @@ -1428,7 +1428,7 @@ namespace std{
middle = end;
}

//Now all we do is swap the elements up to the begining
//Now all we do is swap the elements up to the beginning
--last;

while(last > middle){
Expand Down Expand Up @@ -1630,7 +1630,7 @@ namespace std{
return false;
}
}


}

Expand All @@ -1640,7 +1640,7 @@ namespace std{
less<typename iterator_traits<BidirectionalIterator>::value_type> c;
return prev_permutation(first, last, c);
}

template<class BidirectionalIterator, class Compare> _UCXXEXPORT
bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp)
{
Expand Down
14 changes: 7 additions & 7 deletions associative_base
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


#include<memory>
#include<utility.h>
#include<utility>
#include<iterator>
#include<functional>
#include<list>
Expand All @@ -39,7 +39,7 @@ namespace std{
* considerations about how to address multiple entries with the same key.
* The goal is that the tree/storage code should be here, and managing
* single or multiple counts will be left to subclasses.
* Yes, inheritence for the purpose of code sharing is usually a bad idea.
* Yes, inheritance for the purpose of code sharing is usually a bad idea.
* However, since our goal is to reduce the total amount of code written
* and the overall binary size, this seems to be the best approach possible.
*/
Expand Down Expand Up @@ -161,7 +161,7 @@ public:
}
return retval;
}
const_iterator find(const key_type& x) const{
const_iterator find(const key_type& x) const{
const_iterator retval = lower_bound(x);
if(retval == end()){
return retval;
Expand All @@ -171,7 +171,7 @@ public:
}
return retval;
}
size_type count(const key_type& x) const{
size_type count(const key_type& x) const{
size_type retval(0);
const_iterator first = lower_bound(x);
while(first != end() && !c(x, value_to_key(*first))){
Expand All @@ -188,7 +188,7 @@ public:
void erase(iterator pos){
backing.erase(pos.base_iterator());
}
size_type erase(const key_type& x){
size_type erase(const key_type& x){
size_type count(0);
iterator start = lower_bound(x);
iterator end = upper_bound(x);
Expand All @@ -198,7 +198,7 @@ public:
}
return count;
}
void erase(iterator first, iterator last){
void erase(iterator first, iterator last){
while(first != last){
backing.erase(first.base_iterator());
++first;
Expand Down Expand Up @@ -604,7 +604,7 @@ public:
}

iterator insert(const value_type& x){
iterator location = lower_bound(value_to_key(x));
iterator location = lower_bound(this->value_to_key(x));

if(location == begin()){
backing.push_front(x);
Expand Down
4 changes: 2 additions & 2 deletions bitset
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ namespace std{
return *this;
}
bitset<N>& reset(){
for(size_t i = 0; i <= num_bytes; ++i){
for(size_t i = 0; i < num_bytes; ++i){
data[i] = 0;
}
return *this;
Expand All @@ -226,7 +226,7 @@ namespace std{
}

bitset<N>& flip(){
for(size_t i = 0; i <= num_bytes; ++i){
for(size_t i = 0; i < num_bytes; ++i){
data[i] = ~data[i];
}
return *this;
Expand Down
Loading