CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

testSharedPtrConvertible.cc
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // Test compilability and basic functionality of Utility/memory.h
4 //
5 // Author: W. E. Brown, 2010-03-19, adapted from the boost library's
6 // shared_ptr and related functionality whose internal attributions bear
7 // the following various notices:
8 //
9 // Copyright (c) 2008 Peter Dimov
10 // Distributed under the Boost Software License, Version 1.0.
11 // See http://www.boost.org/LICENSE_1_0.txt
12 //
13 // ======================================================================
14 
15 
16 #include "CLHEP/Utility/noncopyable.h"
17 #include "CLHEP/Utility/memory.h"
18 
19 #include <cassert>
20 
21 
22 using namespace CLHEP;
23 using CLHEP::shared_ptr;
24 
25 
26 class incomplete;
27 
28 struct X
29 { };
30 
31 struct Y
32 { };
33 
34 struct Z: public X
35 { };
36 
38 { return 1; }
39 
41 { return 2; }
42 
44 { return 3; }
45 
47 { return 4; }
48 
50 { return 5; }
51 
53 { return 6; }
54 
55 int main()
56 {
58  assert( 1 == f( p1 ) );
59  assert( 1 == f( shared_ptr<double>() ) );
60 
61  shared_ptr<Z> p2;
62  assert( 4 == g( p2 ) );
63  assert( 4 == g( shared_ptr<Z>() ) );
64 
65  return 0;
66 }
int f(shared_ptr< void const >)
int g(shared_ptr< X >)