Hmm, your code worked for me on GCC 3.3.1 under Cygwin / WinNT5.1sp1a. I don't have 3.4.0 at my fingertips yet.
You are using GCC 3.4.0. Did your code work for you in previous versions of GCC? Is it possible that you are using an outdated or incorrect version of <memory>?
$ gcc --version gcc (GCC) 3.3.1 (cygming special) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ -M ap.cpp > ap.d
$ cat ap.d
ap.o: ap.cpp \ /usr/include/c++/3.3.1/memory \ /usr/include/c++/3.3.1/bits/stl_algobase.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/c++config.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/os_defines.h \ /usr/include/c++/3.3.1/cstring \ /usr/include/c++/3.3.1/cstddef \ /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stddef.h \ /usr/include/string.h \ /usr/include/_ansi.h \ /usr/include/newlib.h \ /usr/include/sys/config.h \ /usr/include/machine/ieeefp.h \ /usr/include/cygwin/config.h \ /usr/include/sys/reent.h \ /usr/include/sys/_types.h \ /usr/include/c++/3.3.1/climits \ /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/limits.h \ /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/syslimits.h \ /usr/include/limits.h \ /usr/include/c++/3.3.1/cstdlib \ /usr/include/stdlib.h \ /usr/include/machine/stdlib.h \ /usr/include/alloca.h \ /usr/include/c++/3.3.1/new \ /usr/include/c++/3.3.1/exception \ /usr/include/c++/3.3.1/iosfwd \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/c++locale.h \ /usr/include/c++/3.3.1/clocale \ /usr/include/locale.h \ /usr/include/c++/3.3.1/cctype \ /usr/include/ctype.h \ /usr/include/c++/3.3.1/bits/stringfwd.h \ /usr/include/c++/3.3.1/bits/fpos.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/c++io.h \ /usr/include/c++/3.3.1/cstdio \ /usr/include/stdio.h \ /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/include/stdarg.h \ /usr/include/sys/types.h \ /usr/include/machine/types.h \ /usr/include/sys/features.h \ /usr/include/cygwin/types.h \ /usr/include/sys/sysmacros.h \ /usr/include/stdint.h \ /usr/include/sys/stdio.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/gthr.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/gthr-default.h \ /usr/include/pthread.h \ /usr/include/signal.h \ /usr/include/sys/signal.h \ /usr/include/cygwin/signal.h \ /usr/include/sched.h \ /usr/include/time.h \ /usr/include/machine/time.h \ /usr/include/unistd.h \ /usr/include/sys/unistd.h \ /usr/include/getopt.h \ /usr/include/c++/3.3.1/cwchar \ /usr/include/c++/3.3.1/ctime \ /usr/include/wchar.h \ /usr/include/c++/3.3.1/bits/functexcept.h \ /usr/include/c++/3.3.1/exception_defines.h \ /usr/include/c++/3.3.1/bits/stl_pair.h \ /usr/include/c++/3.3.1/bits/type_traits.h \ /usr/include/c++/3.3.1/bits/stl_iterator_base_types.h \ /usr/include/c++/3.3.1/bits/stl_iterator_base_funcs.h \ /usr/include/c++/3.3.1/bits/concept_check.h \ /usr/include/c++/3.3.1/bits/stl_iterator.h \ /usr/include/c++/3.3.1/bits/stl_alloc.h \ /usr/include/c++/3.3.1/bits/stl_threads.h \ /usr/include/c++/3.3.1/i686-pc-cygwin/bits/atomicity.h \ /usr/include/c++/3.3.1/bits/stl_construct.h \ /usr/include/c++/3.3.1/bits/stl_uninitialized.h \ /usr/include/c++/3.3.1/bits/stl_raw_storage_iter.h
--Eljay