Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-01-21 10:43:04

On Wed, 21 Jan 2004 16:20:36 +0100, Bronek Kozicki wrote:
> not know how Howard wants to define both classes :/ (call me dumb)

Or maybe don't call me dumb. Quick examination of "The Template Guide"
enlightened me.

#include <iostream>
template <typename T> struct move_ptr
  const char* say() const {return "move_ptr<T>::say\n";};
  static const char* ptr() {return "move_ptr<T>::ptr\n";};

template <typename T> struct move_ptr<T[]>
  const char* say() const {return "move_ptr<T[]>::say\n";};
  static const char* arr() {return "move_ptr<T[]>::arr\n";};

template <typename T>
const char* say(move_ptr<T>& t) {return t.say();}

int main()
  std::cout << move_ptr<int>::ptr();
  std::cout << move_ptr<int[]>::arr();

  move_ptr<int> ptr;
  move_ptr<int[]> arr;

  std::cout << say(ptr);
  std::cout << say(arr);

I think that it is more generic, than having two classes move_ptr and
move_arr; isn't it ?


Boost list run by bdawes at, gregod at, cpdaniel at, john at