sick_visionary_cpp_shared
3pp
boost
core
core/swap.hpp
Go to the documentation of this file.
1
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
2
//
3
// Distributed under the Boost Software License, Version 1.0. (See
4
// accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
// For more information, see http://www.boost.org
7
8
9
#ifndef BOOST_CORE_SWAP_HPP
10
#define BOOST_CORE_SWAP_HPP
11
12
// Note: the implementation of this utility contains various workarounds:
13
// - swap_impl is put outside the boost namespace, to avoid infinite
14
// recursion (causing stack overflow) when swapping objects of a primitive
15
// type.
16
// - swap_impl has a using-directive, rather than a using-declaration,
17
// because some compilers (including MSVC 7.1, Borland 5.9.3, and
18
// Intel 8.1) don't do argument-dependent lookup when it has a
19
// using-declaration instead.
20
// - boost::swap has two template arguments, instead of one, to
21
// avoid ambiguity when swapping objects of a Boost type that does
22
// not have its own boost::swap overload.
23
24
#include <utility>
//for std::swap (C++11)
25
#include <algorithm>
//for std::swap (C++98)
26
#include <cstddef>
//for std::size_t
27
#include <
boost/config.hpp
>
28
29
namespace
boost_swap_impl
30
{
31
template
<
class
T>
32
BOOST_GPU_ENABLED
33
void
swap_impl
(
T
& left,
T
& right)
34
{
35
using namespace
std
;
//use std::swap if argument dependent lookup fails
36
swap
(left,right);
37
}
38
39
template
<
class
T, std::
size_t
N>
40
BOOST_GPU_ENABLED
41
void
swap_impl
(
T
(& left)[N],
T
(& right)[N])
42
{
43
for
(std::size_t
i
= 0;
i
< N; ++
i
)
44
{
45
::boost_swap_impl::swap_impl
(left[
i
], right[
i
]);
46
}
47
}
48
}
49
50
namespace
boost
51
{
52
template
<
class
T1,
class
T2>
53
BOOST_GPU_ENABLED
54
void
swap
(T1& left, T2& right)
55
{
56
::boost_swap_impl::swap_impl
(left, right);
57
}
58
}
59
60
#endif
T
T
Definition:
mem_fn_cc.hpp:25
config.hpp
boost::swap
BOOST_GPU_ENABLED void swap(T1 &left, T2 &right)
Definition:
core/swap.hpp:54
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
BOOST_GPU_ENABLED
#define BOOST_GPU_ENABLED
Definition:
nvcc.hpp:16
boost_swap_impl
Definition:
core/swap.hpp:29
boost_swap_impl::swap_impl
BOOST_GPU_ENABLED void swap_impl(T &left, T &right)
Definition:
core/swap.hpp:33
boost::iterators::i
D const & i
Definition:
iterator_facade.hpp:956
std
boost_swap_impl::swap_impl
BOOST_GPU_ENABLED void swap_impl(T(&left)[N], T(&right)[N])
Definition:
core/swap.hpp:41
sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:48:41