Mailinglist Archive: yast-commit (693 mails)
| < Previous | Next > |
[yast-commit] r56507 - in /trunk/storage/libstorage/src: Storage.cc StorageTmpl.h
- From: aschnell@xxxxxxxxxxxxxxxx
- Date: Tue, 31 Mar 2009 14:16:46 -0000
- Message-id: <E1Loeli-0003xe-LR@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Tue Mar 31 16:16:46 2009
New Revision: 56507
URL: http://svn.opensuse.org/viewcvs/yast?rev=56507&view=rev
Log:
- use templated binary function
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageTmpl.h
Modified: trunk/storage/libstorage/src/Storage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=56507&r1=56506&r2=56507&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Tue Mar 31 16:16:46 2009
@@ -3532,7 +3532,7 @@
i->getCommitActions( l );
ac.splice( ac.end(), l );
}
- ac.sort( cont_less<commitAction>() );
+ ac.sort(deref_less<commitAction>());
for( list<commitAction*>::const_iterator i=ac.begin(); i!=ac.end(); ++i
)
{
CommitInfo info;
@@ -3656,7 +3656,7 @@
b << "> ";
y2mil(b.str());
b.str("");
- todo.sort( cont_less<commitAction>() );
+ todo.sort(deref_less<commitAction>());
y2mil("stage:" << stage);
b << "sorted co <";
for( list<const Container*>::const_iterator i=co.begin(); i!=co.end(); ++i
)
@@ -5595,13 +5595,6 @@
return ret;
}
-struct equal_co
- {
- equal_co( const Container* const co ) : c(co) {};
- bool operator()(const Container* co) { return( *co==*c ); }
- const Container* const c;
- };
-
bool
Storage::equalBackupStates(const string& lhs, const string& rhs,
@@ -5634,7 +5627,7 @@
CCIter j;
while( (ret||verbose_log) && i!=l->end() )
{
- j = find_if( r->begin(), r->end(), equal_co( *i ) );
+ j = find_if(r->begin(), r->end(),
bind2nd(deref_equal_to<Container>(), *i));
if( j!=r->end() )
ret = (*i)->compareContainer( *j, verbose_log ) && ret;
else
@@ -5648,7 +5641,7 @@
i=r->begin();
while( (ret||verbose_log) && i!=r->end() )
{
- j = find_if( l->begin(), l->end(), equal_co( *i ) );
+ j = find_if(l->begin(), l->end(),
bind2nd(deref_equal_to<Container>(), *i));
if( j==l->end() )
{
ret = false;
Modified: trunk/storage/libstorage/src/StorageTmpl.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTmpl.h?rev=56507&r1=56506&r2=56507&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTmpl.h (original)
+++ trunk/storage/libstorage/src/StorageTmpl.h Tue Mar 31 16:16:46 2009
@@ -191,12 +191,21 @@
return( s );
}
-template< class Val >
-struct cont_less : public std::binary_function<Val*,Val*,bool>
+
+ template<class Type>
+ struct deref_less : public std::binary_function<const Type*, const Type*,
bool>
{
- bool operator()(const Val* __x, const Val* __y) const { return *__x <
*__y; }
+ bool operator()(const Type* x, const Type* y) const { return *x < *y; }
};
+
+ template<class Type>
+ struct deref_equal_to : public std::binary_function<const Type*, const
Type*, bool>
+ {
+ bool operator()(const Type* x, const Type* y) const { return *x == *y; }
+ };
+
+
template <class T, unsigned int sz>
inline unsigned int lengthof (T (&)[sz]) { return sz; }
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Mar 31 16:16:46 2009
New Revision: 56507
URL: http://svn.opensuse.org/viewcvs/yast?rev=56507&view=rev
Log:
- use templated binary function
Modified:
trunk/storage/libstorage/src/Storage.cc
trunk/storage/libstorage/src/StorageTmpl.h
Modified: trunk/storage/libstorage/src/Storage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=56507&r1=56506&r2=56507&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Storage.cc (original)
+++ trunk/storage/libstorage/src/Storage.cc Tue Mar 31 16:16:46 2009
@@ -3532,7 +3532,7 @@
i->getCommitActions( l );
ac.splice( ac.end(), l );
}
- ac.sort( cont_less<commitAction>() );
+ ac.sort(deref_less<commitAction>());
for( list<commitAction*>::const_iterator i=ac.begin(); i!=ac.end(); ++i
)
{
CommitInfo info;
@@ -3656,7 +3656,7 @@
b << "> ";
y2mil(b.str());
b.str("");
- todo.sort( cont_less<commitAction>() );
+ todo.sort(deref_less<commitAction>());
y2mil("stage:" << stage);
b << "sorted co <";
for( list<const Container*>::const_iterator i=co.begin(); i!=co.end(); ++i
)
@@ -5595,13 +5595,6 @@
return ret;
}
-struct equal_co
- {
- equal_co( const Container* const co ) : c(co) {};
- bool operator()(const Container* co) { return( *co==*c ); }
- const Container* const c;
- };
-
bool
Storage::equalBackupStates(const string& lhs, const string& rhs,
@@ -5634,7 +5627,7 @@
CCIter j;
while( (ret||verbose_log) && i!=l->end() )
{
- j = find_if( r->begin(), r->end(), equal_co( *i ) );
+ j = find_if(r->begin(), r->end(),
bind2nd(deref_equal_to<Container>(), *i));
if( j!=r->end() )
ret = (*i)->compareContainer( *j, verbose_log ) && ret;
else
@@ -5648,7 +5641,7 @@
i=r->begin();
while( (ret||verbose_log) && i!=r->end() )
{
- j = find_if( l->begin(), l->end(), equal_co( *i ) );
+ j = find_if(l->begin(), l->end(),
bind2nd(deref_equal_to<Container>(), *i));
if( j==l->end() )
{
ret = false;
Modified: trunk/storage/libstorage/src/StorageTmpl.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/StorageTmpl.h?rev=56507&r1=56506&r2=56507&view=diff
==============================================================================
--- trunk/storage/libstorage/src/StorageTmpl.h (original)
+++ trunk/storage/libstorage/src/StorageTmpl.h Tue Mar 31 16:16:46 2009
@@ -191,12 +191,21 @@
return( s );
}
-template< class Val >
-struct cont_less : public std::binary_function<Val*,Val*,bool>
+
+ template<class Type>
+ struct deref_less : public std::binary_function<const Type*, const Type*,
bool>
{
- bool operator()(const Val* __x, const Val* __y) const { return *__x <
*__y; }
+ bool operator()(const Type* x, const Type* y) const { return *x < *y; }
};
+
+ template<class Type>
+ struct deref_equal_to : public std::binary_function<const Type*, const
Type*, bool>
+ {
+ bool operator()(const Type* x, const Type* y) const { return *x == *y; }
+ };
+
+
template <class T, unsigned int sz>
inline unsigned int lengthof (T (&)[sz]) { return sz; }
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |