Classes | Functions
Wrapper_t.cpp File Reference
#include "canvas/Persistency/Common/Wrapper.h"
#include <cassert>
#include <iostream>
#include <memory>
#include <vector>

Go to the source code of this file.

Classes

class  CopyNoSwappy
 
class  SwappyNoCopy
 

Functions

void work ()
 
int main ()
 

Function Documentation

int main ( )

Definition at line 51 of file Wrapper_t.cpp.

52 {
53  int rc = 0;
54  try {
55  work();
56  }
57  catch (...) {
58  rc = 1;
59  std::cerr << "Failure: unidentified exception caught\n";
60  }
61  return rc;
62 }
void work()
Definition: Wrapper_t.cpp:33
void work ( )

Definition at line 33 of file Wrapper_t.cpp.

34 {
35  std::unique_ptr<CopyNoSwappy> thing(new CopyNoSwappy);
36  art::Wrapper<CopyNoSwappy> wrap(thing);
37 
38  std::unique_ptr<SwappyNoCopy> thing2(new SwappyNoCopy);
39  art::Wrapper<SwappyNoCopy> wrap2(thing2);
40 
41 
42  std::unique_ptr<std::vector<double> >
43  thing3(new std::vector<double>(10,2.2));
44  assert(thing3->size() == 10);
45 
46  art::Wrapper<std::vector<double> > wrap3(thing3);
47  assert(wrap3->size() == 10);
48  assert(thing3.get() == 0);
49 }