mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 12:07:36 +02:00
Optimizing for RVO
[SVN r35249]
This commit is contained in:
@ -31,10 +31,10 @@ namespace boost { namespace fusion
|
|||||||
|
|
||||||
call(First const&, Last const&)
|
call(First const&, Last const&)
|
||||||
{
|
{
|
||||||
static typename mpl::minus<
|
typedef typename mpl::minus<
|
||||||
typename Last::index, typename First::index>::type
|
typename Last::index, typename First::index>::type
|
||||||
result;
|
result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -35,8 +35,7 @@ namespace boost { namespace fusion
|
|||||||
static type
|
static type
|
||||||
call(Iterator const& i)
|
call(Iterator const& i)
|
||||||
{
|
{
|
||||||
static type result;
|
return type();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -34,11 +34,11 @@ namespace boost { namespace fusion
|
|||||||
, typename Last::iterator_type>::type
|
, typename Last::iterator_type>::type
|
||||||
call(First const&, Last const&)
|
call(First const&, Last const&)
|
||||||
{
|
{
|
||||||
static typename mpl::distance<
|
typedef typename mpl::distance<
|
||||||
typename First::iterator_type
|
typename First::iterator_type
|
||||||
, typename Last::iterator_type>::type
|
, typename Last::iterator_type>::type
|
||||||
result;
|
result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -35,8 +35,7 @@ namespace boost { namespace fusion
|
|||||||
static type
|
static type
|
||||||
call(Iterator)
|
call(Iterator)
|
||||||
{
|
{
|
||||||
static type result;
|
return type();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,10 +29,10 @@ namespace boost { namespace fusion
|
|||||||
typename Last::index, typename First::index>::type
|
typename Last::index, typename First::index>::type
|
||||||
call(First const&, Last const&)
|
call(First const&, Last const&)
|
||||||
{
|
{
|
||||||
static typename mpl::minus<
|
typedef typename mpl::minus<
|
||||||
typename Last::index, typename First::index>::type
|
typename Last::index, typename First::index>::type
|
||||||
result;
|
result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,10 +29,10 @@ namespace boost { namespace fusion
|
|||||||
typename Last::index, typename First::index>::type
|
typename Last::index, typename First::index>::type
|
||||||
call(First const&, Last const&)
|
call(First const&, Last const&)
|
||||||
{
|
{
|
||||||
static typename mpl::minus<
|
typedef typename mpl::minus<
|
||||||
typename Last::index, typename First::index>::type
|
typename Last::index, typename First::index>::type
|
||||||
result;
|
result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include <boost/mpl/bool.hpp>
|
#include <boost/mpl/bool.hpp>
|
||||||
#include <boost/type_traits/add_reference.hpp>
|
#include <boost/type_traits/add_reference.hpp>
|
||||||
#include <boost/type_traits/add_const.hpp>
|
#include <boost/type_traits/add_const.hpp>
|
||||||
#include <boost/type_traits/is_convertible.hpp>
|
|
||||||
#include <boost/utility/enable_if.hpp>
|
|
||||||
|
|
||||||
namespace boost { namespace fusion
|
namespace boost { namespace fusion
|
||||||
{
|
{
|
||||||
@ -54,20 +52,11 @@ namespace boost { namespace fusion
|
|||||||
: vec(rhs.vec) {}
|
: vec(rhs.vec) {}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
explicit vector(
|
explicit vector(T const& rhs)
|
||||||
T const& rhs
|
|
||||||
#if defined(BOOST_MSVC)
|
|
||||||
// VC++ gets confused when RHS is a derived type. It fails to call
|
|
||||||
// the copy ctor and attempts to call this templated constructor instead.
|
|
||||||
, typename disable_if<
|
|
||||||
is_convertible<T, vector> // use copy ctor instead
|
|
||||||
>::type* dummy = 0
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
: vec(rhs) {}
|
: vec(rhs) {}
|
||||||
|
|
||||||
// Expand a couple of forwarding constructors for arguments
|
// Expand a couple of forwarding constructors for arguments
|
||||||
// of type (T0), (T0, T1), (T0, T1, T2) etc. Exanple:
|
// of type (T0), (T0, T1), (T0, T1, T2) etc. Example:
|
||||||
//
|
//
|
||||||
// vector(
|
// vector(
|
||||||
// typename detail::call_param<T0>::type _0
|
// typename detail::call_param<T0>::type _0
|
||||||
|
@ -41,8 +41,8 @@ namespace boost { namespace fusion
|
|||||||
inline typename result_of::empty<Sequence>::type
|
inline typename result_of::empty<Sequence>::type
|
||||||
empty(Sequence const&)
|
empty(Sequence const&)
|
||||||
{
|
{
|
||||||
static typename result_of::empty<Sequence>::type result;
|
typedef typename result_of::empty<Sequence>::type result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ namespace boost { namespace fusion
|
|||||||
inline typename result_of::has_key<Sequence, Key>::type
|
inline typename result_of::has_key<Sequence, Key>::type
|
||||||
has_key(Sequence const& seq)
|
has_key(Sequence const& seq)
|
||||||
{
|
{
|
||||||
static typename result_of::has_key<Sequence, Key>::type result;
|
typedef typename result_of::has_key<Sequence, Key>::type result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ namespace boost { namespace fusion
|
|||||||
inline typename result_of::size<Sequence>::type
|
inline typename result_of::size<Sequence>::type
|
||||||
size(Sequence const&)
|
size(Sequence const&)
|
||||||
{
|
{
|
||||||
static typename result_of::size<Sequence>::type result;
|
typedef typename result_of::size<Sequence>::type result;
|
||||||
return result;
|
return result();
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user