added new shared pointer with simpler interface; refs #7
This commit is contained in:
		@@ -4,7 +4,7 @@
 | 
			
		||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
 | 
			
		||||
 | 
			
		||||
exampledir = ${docdir}/examples
 | 
			
		||||
example_PROGRAMS = smartpointer arguments
 | 
			
		||||
example_PROGRAMS = smartpointer arguments shared
 | 
			
		||||
if HAVE_STACKTRACE
 | 
			
		||||
example_PROGRAMS += exceptionhandling
 | 
			
		||||
endif
 | 
			
		||||
@@ -24,4 +24,6 @@ smartpointer_LDADD = ${top_builddir}/src/.libs/libmrw.la
 | 
			
		||||
 | 
			
		||||
arguments_SOURCES = arguments.cxx
 | 
			
		||||
 | 
			
		||||
shared_SOURCES = shared.cxx
 | 
			
		||||
 | 
			
		||||
MAINTAINERCLEANFILES = makefile.in
 | 
			
		||||
							
								
								
									
										30
									
								
								doc/examples/shared.cxx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								doc/examples/shared.cxx
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
/*! @file
 | 
			
		||||
 | 
			
		||||
    @id $Id$
 | 
			
		||||
*/
 | 
			
		||||
//       1         2         3         4         5         6         7         8
 | 
			
		||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
 | 
			
		||||
 | 
			
		||||
#include <mrw/shared.hxx>
 | 
			
		||||
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
class Test {
 | 
			
		||||
  public:
 | 
			
		||||
    Test(int i): _int1(i), _int2(0) {}
 | 
			
		||||
    Test(int i, int j): _int1(i), _int2(j) {}
 | 
			
		||||
    int _int1;
 | 
			
		||||
    int _int2;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int main(int, char**) {
 | 
			
		||||
  mrw::Shared<Test> test1(15);
 | 
			
		||||
  mrw::Shared<Test> test2(13, 14);
 | 
			
		||||
  mrw::Shared<Test> test3(new Test(13));
 | 
			
		||||
  mrw::Shared<Test> test4(test2);
 | 
			
		||||
  std::cout<<"test1="<<test1->_int1<<", "<<test1->_int2<<std::endl
 | 
			
		||||
           <<"test2="<<test2->_int1<<", "<<test2->_int2<<std::endl
 | 
			
		||||
           <<"test3="<<test3->_int1<<", "<<test3->_int2<<std::endl
 | 
			
		||||
           <<"test4="<<test4->_int1<<", "<<test4->_int2<<std::endl;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user