Skip to content

Commit

Permalink
std::list::unique added
Browse files Browse the repository at this point in the history
^_^
  • Loading branch information
brynne8 committed May 11, 2014
1 parent 37a11d9 commit fd4996a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions bld/hdr/watcom/list.mh
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,29 @@ namespace std {
void splice( iterator it, list &other, iterator first, iterator last );

void reverse( );
void unique( );
void merge( list &other );

template< class BinaryPredicate >
void unique( BinaryPredicate pred )
{
iterator first( begin( ) );
iterator last ( end( ) );

if ( first == last )
return;

iterator next( first );

while ( !(++next == last) )
{
if ( pred( *first, *next ) )
erase( next );
else
first = next;
next = first;
}
}

// sort( )
// *******
Expand Down Expand Up @@ -1022,6 +1044,29 @@ namespace std {
sentinel->previous = temp;
}

// unique( )
// **********
template< class Type, class Allocator >
void list< Type, Allocator >::unique( )
{
iterator first( begin( ) );
iterator last ( end( ) );

if ( first == last )
return;

iterator next( first );

while ( !(++next == last) )
{
if ( *first == *next )
erase( next );
else
first = next;
next = first;
}
}

// merge( list & )
// ***************
template< class Type, class Allocator >
Expand Down

2 comments on commit fd4996a

@iainnicol
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexanderMisel 你好,很抱歉中文翻译的不好。目前Open Watcom使用的是一个奇怪的软件许可。我们想在 “Apache 2.0 license plus LLVM Exceptions” 下重新授权Open Watcom。你觉得这样可以吗

Hi. Sorry for the bad translation into Chinese. Currently Open Watcom uses a weird software license. We want to relicense Open Watcom under “Apache 2.0 license plus LLVM Exceptions”. Is this okay with you?

@brynne8
Copy link
Contributor Author

@brynne8 brynne8 commented on fd4996a Jun 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's okay with me.

Please sign in to comment.