Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
Main Page
Related Pages
Namespaces
Classes
Examples
spatial_template_member_swap.hpp
1
// -*- C++ -*-
2
//
3
// Copyright Sylvain Bougerel 2009 - 2013.
4
// Distributed under the Boost Software License, Version 1.0.
5
// (See accompanying file COPYING or copy at
6
// http://www.boost.org/LICENSE_1_0.txt)
7
14
#ifndef SPATIAL_TEMPLATE_MEMBER_SWAP_HPP
15
#define SPATIAL_TEMPLATE_MEMBER_SWAP_HPP
16
17
#include <algorithm>
// provides: ::std::swap
18
// provides: import::is_empty, import::false_type and import::true_type
19
#include "spatial_import_type_traits.hpp"
20
21
namespace
spatial
22
{
23
namespace
details
24
{
26
29
template
<
bool
,
typename
Tp>
30
struct
template_member_assign_provider
31
{
32
static
void
do_it
(Tp& left,
const
Tp& right)
33
{ left = right; }
34
};
35
36
template
<
typename
Tp>
37
struct
template_member_assign_provider
<true, Tp>
38
{
static
void
do_it
(Tp&,
const
Tp&) { } };
39
40
template
<
typename
Tp>
41
struct
template_member_assign
42
:
template_member_assign_provider
<import::is_empty<Tp>::value, Tp>
43
{ };
45
47
50
template
<
bool
,
typename
Tp>
51
struct
template_member_swap_provider
52
{
53
static
void
do_it
(Tp& left, Tp& right)
54
{
55
using ::std::swap;
56
swap
(left, right);
57
}
58
};
59
60
template
<
typename
Tp>
61
struct
template_member_swap_provider
<true, Tp>
62
{
static
void
do_it
(Tp&, Tp&) { } };
63
64
template
<
typename
Tp>
65
struct
template_member_swap
66
:
template_member_swap_provider
<import::is_empty<Tp>::value, Tp>
67
{ };
69
}
70
}
71
72
#endif // SPATIAL_TEMPLATE_MEMBER_SWAP_HPP
spatial::details::template_member_swap_provider
Perform a specialized swap for empty classes.
Definition:
spatial_template_member_swap.hpp:51
spatial::details::template_member_swap
Definition:
spatial_template_member_swap.hpp:65
spatial::details::template_member_assign
Definition:
spatial_template_member_swap.hpp:41
spatial::details::template_member_assign_provider< true, Tp >::do_it
static void do_it(Tp &, const Tp &)
Definition:
spatial_template_member_swap.hpp:38
spatial::details::template_member_assign_provider
Perform a specialized assign for empty classes.
Definition:
spatial_template_member_swap.hpp:30
spatial::details::template_member_assign_provider::do_it
static void do_it(Tp &left, const Tp &right)
Definition:
spatial_template_member_swap.hpp:32
spatial::details::template_member_swap_provider::do_it
static void do_it(Tp &left, Tp &right)
Definition:
spatial_template_member_swap.hpp:53
spatial
The main namespace used in the library.
Definition:
algorithm.hpp:23
spatial::details::template_member_swap_provider< true, Tp >::do_it
static void do_it(Tp &, Tp &)
Definition:
spatial_template_member_swap.hpp:62
spatial::details::swap
void swap(Kdtree< Rank, Key, Value, Compare, Alloc > &left, Kdtree< Rank, Key, Value, Compare, Alloc > &right)
Swap the content of the tree left and right.
Definition:
spatial_kdtree.hpp:595
src
bits
spatial_template_member_swap.hpp
Generated on Sun Dec 6 2015 18:48:45 for Spatial C++ Library by
1.8.10