Beispiel #1
0
/*
  ..main
//*/
int main()
{
  using namespace std;

  cout << "Allocation Policies\n";

  /*
    create with new
  //*/
  cout << "UserClass< int, NewPolicy< int > >\n";
  typedef UserClass< int, NewPolicy< int > > IntNewUser_t;

  IntNewUser_t intNewUser;

  intNewUser.doSomething();
  cout << endl;


  /*
    create with malloc
  //*/
  cout << "UserClass< int, MallocPolicy< int > >\n";
  typedef UserClass< int, MallocPolicy< int > > IntMallocUser_t;

  IntMallocUser_t intMallocUser;

  intMallocUser.doSomething();
  cout << endl;


  cout << "READY.\n";
  return 0;
}
Beispiel #2
0
/*
  ..main
//*/
int main()
{
  using namespace std;

  cout << "Allocation Policies\n";

  /*
    create with 'int' and 'NewPolicy'
  //*/
  cout << "UserClass< int >\n";

  typedef UserClass< int >
    IntNewUser_t;

  IntNewUser_t intNewUser;

  intNewUser.doSomething();
  cout << endl;


  /*
    create with 'std::string' and 'MallocPolicy'

    internally we will still use 'char' and NOT a 'const char*' as
    'std::string' might be!
  //*/
  cout << "UserClass< std::string >\n";
  typedef UserClass< std::string >
    StringMallocUser_t;

  StringMallocUser_t stringMallocUser;

  stringMallocUser.doSomething();
  cout << endl;


  cout << "READY.\n";
  return 0;
}