~ubuntu-branches/ubuntu/saucy/deal.ii/saucy

« back to all changes in this revision

Viewing changes to contrib/boost/include/boost/fusion/algorithm/transformation/detail/replace.hpp

  • Committer: Package Import Robot
  • Author(s): "Adam C. Powell, IV", Adam C. Powell, IV, Christophe Trophime
  • Date: 2012-02-21 06:57:30 UTC
  • mfrom: (3.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20120221065730-r2iz70lg557wcd2e
Tags: 7.1.0-1
[ Adam C. Powell, IV ]
* New upstream (closes: #652057).
* Updated to use PETSc and SLEPc 3.2, and forward-ported all patches.
* Removed NetCDF Build-Depends because it uses serial HDF5.
* Made Sacado cmath patch work with new configure.
* Moved -dev package symlink lines in rules to arch all section.

[ Christophe Trophime ]
* debian/rules:
   - add dh_strip --dbg-package to generate dbg package (closes: #652058)
   - add .install files to simplify rules
* Add support for mumps, arpack (closes: #637655)
* Add patch for slepc 3.2 (closes: #659245)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=============================================================================
2
 
    Copyright (c) 2001-2006 Joel de Guzman
3
 
 
4
 
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
5
 
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
 
==============================================================================*/
7
 
#if !defined(FUSION_REPLACE_08182005_0841)
8
 
#define FUSION_REPLACE_08182005_0841
9
 
 
10
 
#include <boost/type_traits/is_convertible.hpp>
11
 
#include <boost/mpl/if.hpp>
12
 
#include <boost/type_traits/remove_reference.hpp>
13
 
 
14
 
namespace boost { namespace fusion { namespace detail
15
 
{
16
 
    template <bool is_convertible>
17
 
    struct replacer_helper;
18
 
 
19
 
    template <>
20
 
    struct replacer_helper<false>
21
 
    {
22
 
        template <typename U, typename T>
23
 
        static U&
24
 
        call(U& x, T const&, T const&)
25
 
        {
26
 
            return x;
27
 
        }
28
 
    };
29
 
 
30
 
    template <>
31
 
    struct replacer_helper<true>
32
 
    {
33
 
        template <typename U, typename T>
34
 
        static U
35
 
        call(U& x, T const& old_value, T const& new_value)
36
 
        {
37
 
            return (x == old_value) ? new_value : x;
38
 
        }
39
 
    };
40
 
 
41
 
    template <typename T>
42
 
    struct replacer
43
 
    {
44
 
        replacer(T const& old_value, T const& new_value)
45
 
            : old_value(old_value), new_value(new_value) {}
46
 
 
47
 
        template<typename Sig>
48
 
        struct result;
49
 
 
50
 
        template <typename U1, typename U2>
51
 
        struct result<replacer<U1>(U2)>
52
 
        {
53
 
            typedef typename remove_reference<U2>::type value;
54
 
            typedef typename
55
 
                mpl::if_<is_convertible<T, value>, value, value const&>::type
56
 
            type;
57
 
        };
58
 
    
59
 
        template <typename U>
60
 
        typename result<replacer(U)>::type
61
 
        operator()(U const& x) const
62
 
        {
63
 
            return replacer_helper<is_convertible<T, U>::value>::
64
 
                call(x, old_value, new_value);
65
 
        }
66
 
 
67
 
        T old_value;
68
 
        T new_value;
69
 
    };
70
 
}}}
71
 
 
72
 
#endif
73