|
From: <syn...@us...> - 2009-01-28 18:12:23
|
Revision: 954
http://loki-lib.svn.sourceforge.net/loki-lib/?rev=954&view=rev
Author: syntheticpp
Date: 2009-01-28 18:12:10 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
Add Rich's idea to pass the value into the policy
Modified Paths:
--------------
trunk/include/loki/CheckReturn.h
Modified: trunk/include/loki/CheckReturn.h
===================================================================
--- trunk/include/loki/CheckReturn.h 2009-01-28 04:19:22 UTC (rev 953)
+++ trunk/include/loki/CheckReturn.h 2009-01-28 18:12:10 UTC (rev 954)
@@ -60,34 +60,36 @@
////////////////////////////////////////////////////////////////////////////////
+template<class T>
struct IgnoreReturnValue
{
- static void run()
+ static void run(const T&)
{
/// Do nothing at all.
}
};
-
+template<class T>
struct TriggerAssert
{
- static void run()
+ static void run(const T&)
{
assert( 0 );
}
};
-
+template<class T>
struct FprintfStderr
{
- static void run()
+ static void run(const T&)
{
fprintf(stderr, "CheckReturn: return value was not checked\n");
}
};
-template < class Value , typename OnError = TriggerAssert>
+
+template < class Value , template<class> class OnError = TriggerAssert >
class CheckReturn
{
public:
@@ -109,7 +111,7 @@
// If m_checked is false, then a function failed to check the
// return value from a function call.
if (!m_checked)
- OnError::run();
+ OnError<Value>::run(m_value);
}
/// Conversion operator changes CheckReturn back to Value type.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|