summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/FaultTolerance/FLARe/ArgPair.cpp
blob: 1a46269e58a96da8410c60ce756727af9169574c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "ArgPair.h"

#include <algorithm>

ArgPair::ArgPair (int c, char **v)
  : argc (c),
    argv (new char *[c])
{
  (void) std::copy (v, v + c, this->argv);
}

ArgPair::ArgPair (const ArgPair &ap)
  : argc (ap.argc),
    argv (new char *[ap.argc])
{
  (void) std::copy (ap.argv, ap.argv + ap.argc, this->argv);
}
  
ArgPair & ArgPair::operator = (const ArgPair &ap)
{
  if (this != &ap)
  {
    ArgPair temp (ap);
    this->swap (temp);
  }
  return *this;
}

void ArgPair::swap (ArgPair &ap)
{
  std::swap (this->argc, ap.argc);
  std::swap (this->argv, ap.argv);
}

ArgPair::~ArgPair()
{
  delete [] argv;
}