started to program macros to expand constrated class and function code

This commit is contained in:
Lorenzo Caminiti
2015-03-28 16:45:01 -07:00
parent 73f2c7ece0
commit 4a871dc233
23 changed files with 610 additions and 10 deletions

30
test/code/class.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include <boost/contract.hpp>
#include <vector>
template< typename T, class Alloc >
struct pushable {
virtual ~pushable ( ) { }
virtual void push_back ( T const& value ) = 0;
};
BOOST_CONTRACT_CLASS(
template( typename T, class Alloc, default std::allocator<T> )
class (vector) extends( public (pushable<T, Alloc>) )
) {
BOOST_CONTRACT_CLASS_INVARIANT_TPL()
BOOST_CONTRACT_FUNCTION_TPL(
public void (push_back) ( (T const&) value )
) {
vector_.push_back(value);
}
private:
std::vector<T, Alloc> vector_;
}
int main ( ) {
return 0;
}