• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//  (C) Copyright John Maddock 2012
2
3//  Use, modification and distribution are subject to the
4//  Boost Software License, Version 1.0. (See accompanying file
5//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7//  See http://www.boost.org/libs/config for more information.
8
9//  MACRO:         BOOST_NO_CXX11_SMART_PTR
10//  TITLE:         C++11 <memory> has no shared_ptr and unique_ptr
11//  DESCRIPTION:   The compiler does not support the C++11 smart pointer features added to <memory>
12
13#include <memory>
14// Hash functions for shared pointers should be in <memory>
15// but with some std lib's we have to include <functional> as well...
16#include <functional>
17
18namespace boost_no_cxx11_smart_ptr {
19
20int test()
21{
22   std::unique_ptr<int> upi(new int);
23   std::shared_ptr<int> spi(new int), spi2(new int);
24   spi = std::static_pointer_cast<int>(spi);
25
26   std::hash<std::shared_ptr<int> > h1;
27   std::hash<std::unique_ptr<int> > h2;
28
29   (void)h1;
30   (void)h2;
31
32   return 0;
33}
34
35}
36