Exemple #1
0
 * thread's lifetime.
 *
 * @warning If the wrapped thread is not standard conformant, the behavior is
 *          undefined.
 */
template <typename Thread>
class standard_thread : private trackable_thread, public Thread {
    BOOST_MOVABLE_BUT_NOT_COPYABLE(standard_thread)
    using trackable_thread::get_thread_function;

public:
    standard_thread() BOOST_NOEXCEPT { }

#ifndef BOOST_NO_CXX11_VARIADIC_TEMPLATES
    template <typename F, typename ...Args>
    explicit standard_thread(BOOST_FWD_REF(F) f,
                             BOOST_FWD_REF(Args) ...args)
        : Thread(get_thread_function(boost::forward<F>(f)),
                                     boost::forward<Args>(args)...)
    { }
#else
    template <typename F>
    explicit standard_thread(BOOST_FWD_REF(F) f)
        : Thread(get_thread_function(boost::forward<F>(f)))
    { }

    template <typename F, typename A0>
    standard_thread(BOOST_FWD_REF(F) f, BOOST_FWD_REF(A0) a0)
        : Thread(get_thread_function(boost::forward<F>(f)),
                                     boost::forward<A0>(a0))
    { }
Exemple #2
0
namespace boost
{
  namespace csbl
  {
    template <class T>
    class devector
    {
      typedef csbl::vector<T> vector_type;
      vector_type data_;
      std::size_t front_index_;

      BOOST_COPYABLE_AND_MOVABLE(devector)

      template <class U>
      void priv_push_back(BOOST_FWD_REF(U) x)
      { data_.push_back(boost::forward<U>(x)); }

    public:
      typedef typename vector_type::size_type size_type;
      typedef typename vector_type::reference reference;
      typedef typename vector_type::const_reference const_reference;


      devector() : front_index_(0) {}
      devector(devector const& x) BOOST_NOEXCEPT
         :  data_(x.data_),
            front_index_(x.front_index_)
      {}
      devector(BOOST_RV_REF(devector) x) BOOST_NOEXCEPT
         :  data_(boost::move(x.data_)),
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/move/move.hpp>
#include "../example/movable.hpp"
#include <cstdio>

class non_movable
{
   public:
   non_movable()
   {}
};

template<class MaybeMovableOnly, class MaybeRvalue>
void function_construct(BOOST_FWD_REF(MaybeRvalue) x)
{
   //Moves in case Convertible is boost::rv<movable> copies otherwise
   //For C++0x perfect forwarding
   MaybeMovableOnly m(boost::forward<MaybeRvalue>(x));
}

int main()
{
   movable m;
   function_construct<movable>(boost::move(m));
   non_movable nm;
   function_construct<non_movable>(boost::move(nm));
   const non_movable cnm;
   function_construct<non_movable>(cnm);
   return 0;
Exemple #4
0
      : first(p.first), second(p.second)
   {}

   template <class D, class S>
   pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
      : first(::boost::move(p.first)), second(::boost::move(p.second))
   {}

   //pair from two values
   pair(const T1 &t1, const T2 &t2)
      : first(t1)
      , second(t2)
   {}

   template<class U, class V>
   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
      : first(::boost::forward<U>(u))
      , second(::boost::forward<V>(v))
   {}

   //And now compatibility with std::pair
   pair(const std::pair<T1, T2>& x)
      : first(x.first), second(x.second)
   {}

   template <class D, class S>
   pair(const std::pair<D, S>& p)
      : first(p.first), second(p.second)
   {}

   pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p)
    BOOST_UNORDERED_CALL_FORWARD(z, BOOST_PP_INC(i), a)

    BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(1, 2, _)
    BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
        BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL, _)

#undef BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL
#undef BOOST_UNORDERED_CALL_FORWARD2

#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
#endif // BOOST_UNORDERED_STD_FORWARD_MOVE

    ////////////////////////////////////////////////////////////////////////////
    // Construct without using the emplace args mechanism.

    template <typename T, typename A0>
    inline void construct_impl2(T* address, BOOST_FWD_REF(A0) a0)
    {
        new((void*) address) T(
            boost::forward<A0>(a0)
        );
    }

}}}

#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif

#endif
Exemple #6
0
        promise(BOOST_RV_REF(completed_callback_type) data_sink)
          : future_data_type(boost::move(data_sink)), back_ptr_(0)
        {}

        // The implementation of the component is responsible for deleting the
        // actual managed component object
        ~promise()
        {
            this->finalize();
            delete back_ptr_;
        }

        // helper functions for setting data (if successful) or the error (if
        // non-successful)
        template <typename T>
        void set_local_data(BOOST_FWD_REF(T) result)
        {
            return this->set_data(boost::forward<result_type>(result));
        }

        ///////////////////////////////////////////////////////////////////////
        // exposed functionality of this component

        // trigger the future, set the result
        void set_value (BOOST_RV_REF(RemoteResult) result)
        {
            // set the received result, reset error status
            this->set_data(boost::move(result));
        }

        Result get_value()
Exemple #7
0
#define BOOST_THREAD_EXCEPTIONAL_PTR_HPP

#include <boost/thread/detail/move.hpp>
#include <boost/exception_ptr.hpp>

#include <boost/config/abi_prefix.hpp>

namespace boost
{
  struct exceptional_ptr {
    exception_ptr ptr_;

    exceptional_ptr() : ptr_() {}
    explicit exceptional_ptr(exception_ptr ex) : ptr_(ex) {}
    template <class E>
    explicit exceptional_ptr(BOOST_FWD_REF(E) ex) : ptr_(boost::copy_exception(boost::forward<E>(ex))) {}
  };

  template <class E>
  inline exceptional_ptr make_exceptional(BOOST_FWD_REF(E) ex) {
    return exceptional_ptr(boost::forward<E>(ex));
  }

  inline exceptional_ptr make_exceptional(exception_ptr ex)
  {
    return exceptional_ptr(ex);
  }

  inline exceptional_ptr make_exceptional()
  {
    return exceptional_ptr();
Exemple #8
0
   template<class It>
   NodePtr create_node_from_it(const It &it)
   {
      NodePtr p = this->allocate_one();
      Deallocator node_deallocator(p, this->node_alloc());
      ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it);
      node_deallocator.release();
      //This does not throw
      typedef typename Node::hook_type hook_type;
      ::new(static_cast<hook_type*>(container_detail::to_raw_pointer(p)), boost_container_new_t()) hook_type;
      return (p);
   }

   template<class KeyConvertible>
   NodePtr create_node_from_key(BOOST_FWD_REF(KeyConvertible) key)
   {
      NodePtr p = this->allocate_one();
      NodeAlloc &na = this->node_alloc();
      Deallocator node_deallocator(p, this->node_alloc());
      node_allocator_traits_type::construct
         (na, container_detail::addressof(p->m_data.first), boost::forward<KeyConvertible>(key));
      BOOST_TRY{
         node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second));
      }
      BOOST_CATCH(...){
         node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first));
         BOOST_RETHROW;
      }
      BOOST_CATCH_END
      node_deallocator.release();
Exemple #9
0
    ///////////////////////////////////////////////////////////////////////////
    namespace detail
    {
        ///////////////////////////////////////////////////////////////////////
        template <
            typename Action, typename BoundArgs, typename UnboundArgs
          , typename Enable = void
        >
        struct bind_action_apply_impl;

        template <typename Action, typename BoundArgs, typename UnboundArgs>
        BOOST_FORCEINLINE
        bool
        bind_action_apply(
            BoundArgs& bound_args
          , BOOST_FWD_REF(UnboundArgs) unbound_args
        )
        {
            return
                bind_action_apply_impl<Action, BoundArgs, UnboundArgs>::call(
                    bound_args
                  , boost::forward<UnboundArgs>(unbound_args)
                );
        }

        ///////////////////////////////////////////////////////////////////////
        template <
            typename Action, typename BoundArgs, typename UnboundArgs
          , typename Enable = void
        >
        struct bind_action_async_impl;
         catch (...) {
             
             cont->trigger_error(boost::current_exception());
         }
         return threads::terminated;
     }
 };
 
 
 
 template <typename Action>
 struct construct_continuation_thread_function_voidN<Action, 0>
 {
     template <typename Func, typename Arguments>
     static HPX_STD_FUNCTION<threads::thread_function_type>
     call(continuation_type cont, BOOST_FWD_REF(Func) func,
         BOOST_FWD_REF(Arguments) args)
     {
         return HPX_STD_BIND(
             continuation_thread_function_void_0<Action>(),
             cont, boost::forward<Func>(func)
           
                 );
     }
 };
 
 template <typename Action>
 struct continuation_thread_function_0
 {
     typedef threads::thread_state_enum result_type;
     template <typename Func
Exemple #11
0
// Copyright (c) 2007-2013 Hartmut Kaiser
// Copyright (c) 2012-2013 Thomas Heller
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


namespace hpx
{
    
    template <typename T0>
    lcos::unique_future<HPX_STD_TUPLE<typename util::decay<T0>::type> >
    when_any(BOOST_FWD_REF(T0) f0, error_code& ec = throws)
    {
        return when_n(1, boost::forward<T0>( f0 ), ec);
    }
    template <typename T0>
    void
    wait_any(BOOST_FWD_REF(T0) f0, error_code& ec = throws)
    {
        return wait_n(1, boost::forward<T0>( f0 ), ec);
    }
}
namespace hpx
{
    
    template <typename T0 , typename T1>
    lcos::unique_future<HPX_STD_TUPLE<typename util::decay<T0>::type , typename util::decay<T1>::type> >
// Copyright (c) 2007-2013 Hartmut Kaiser
// Copyright (c) 2012-2013 Thomas Heller
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


        
    template <typename U0>
    BOOST_FORCEINLINE
    bool
    apply(BOOST_FWD_REF(U0) u0) const
    {
        return
            detail::bind_action_apply<Action>(
                _bound_args
              , util::forward_as_tuple(boost::forward<U0>( u0 ))
            );
    }
    
    template <typename U0>
    BOOST_FORCEINLINE
    hpx::lcos::unique_future<result_type>
    async(BOOST_FWD_REF(U0) u0) const
    {
        return
            detail::bind_action_async<Action>(
                _bound_args
Exemple #13
0
#if !defined(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
#  include <hpx/preprocessed/apply.hpp>
#else

#if defined(__WAVE__) && defined(HPX_CREATE_PREPROCESSED_FILES)
#  pragma wave option(preserve: 1, line: 0, output: "preprocessed/apply_" HPX_LIMIT_STR ".hpp")
#endif

///////////////////////////////////////////////////////////////////////////////
namespace hpx
{
    ///////////////////////////////////////////////////////////////////////////
    // simply launch the given function or function object asynchronously
    template <typename F>
    bool apply(BOOST_FWD_REF(F) f)
    {
        thread t(boost::forward<F>(f));
        t.detach();     // detach the thread
        return false;   // executed locally
    }

    ///////////////////////////////////////////////////////////////////////////
    // Define apply() overloads for plain local functions and function objects.
    //
    // Note that these overloads are limited to function objects supporting the
    // result_of protocol. We will need to revisit this as soon as we will be
    // able to implement a proper is_callable trait (current compiler support
    // does not allow to do that portably).

    // simply launch the given function or function object asynchronously
Exemple #14
0
#include <hpx/util/move.hpp>
#include <hpx/util/tuple.hpp>
#include <hpx/util/detail/pp_strip_parens.hpp>

#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>

#include <boost/type_traits/add_const.hpp>

namespace hpx { namespace util
{
    template <typename R, typename F>
    BOOST_FORCEINLINE
    R
    invoke_fused_r(BOOST_FWD_REF(F) f, util::tuple<>)
    {
        return invoke_r<R>(boost::forward<F>(f));
    }

    template <typename F>
    BOOST_FORCEINLINE
    typename invoke_result_of<F()>::type
    invoke_fused(BOOST_FWD_REF(F) f, util::tuple<>)
    {
        return invoke(boost::forward<F>(f));
    }
}}

#if !defined(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
#  include <hpx/util/preprocessed/invoke_fused.hpp>
Exemple #15
0
// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


namespace hpx
{
    
    
    
    template <typename F>
    typename boost::lazy_enable_if_c<
        traits::detail::is_callable_not_action<F()>::value
     && !traits::is_bound_action<typename util::decay<F>::type>::value
      , detail::create_future<F()>
    >::type
    async (BOOST_SCOPED_ENUM(launch) policy, BOOST_FWD_REF(F) f)
    {
        typedef typename boost::result_of<F()>::type result_type;
        if (policy == launch::sync)
        {
            typedef typename boost::is_void<result_type>::type predicate;
            return detail::call_sync(boost::forward<F>(f), predicate());
        }
        lcos::local::futures_factory<result_type()> p(
            boost::forward<F>(f));
        if (detail::has_async_policy(policy))
            p.apply();
        return p.get_future();
    }
    template <typename F>
    typename boost::lazy_enable_if_c<
Exemple #16
0
                typename boost::mpl::if_<
                    boost::is_void<result_type>
                  , void(BOOST_PP_CAT(dataflow_frame_, N)::*)(boost::mpl::true_)
                  , void(BOOST_PP_CAT(dataflow_frame_, N)::*)(boost::mpl::false_)
                >::type
                execute_function_type;

            futures_type futures_;

            Policy policy_;
            func_type func_;

            template <typename FFunc, BOOST_PP_ENUM_PARAMS(N, typename A)>
            BOOST_PP_CAT(dataflow_frame_, N)(
                Policy policy
              , BOOST_FWD_REF(FFunc) func
              , HPX_ENUM_FWD_ARGS(N, A, f)
            )
              : futures_(
                    BOOST_PP_ENUM(N, HPX_LCOS_LOCAL_DATAFLOW_FRAME_CTOR_LIST, _)
                )
              , policy_(boost::move(policy))
              , func_(boost::forward<FFunc>(func))
            {}

            BOOST_FORCEINLINE
            void execute(boost::mpl::false_)
            {
                result_type res(
                    boost::move(boost::fusion::invoke(func_, futures_))
                );
    template <typename This, typename Vertex, typename Graph>
    struct result<This(Vertex, Graph)> {
    private:
        typedef typename remove_reference<Graph>::type RawGraph;
        typedef graph_traits<RawGraph> Traits;
        typedef typename Traits::adjacency_iterator AdjacencyIterator;

    public:
        typedef std::pair<AdjacencyIterator, AdjacencyIterator> type;
    };

    template <typename Vertex, typename Graph>
    typename result<
        get_all_adjacent_vertices(BOOST_FWD_REF(Vertex), BOOST_FWD_REF(Graph))
    >::type
    operator()(BOOST_FWD_REF(Vertex) v, BOOST_FWD_REF(Graph) g) const {
        return adjacent_vertices(boost::forward<Vertex>(v),
                                 boost::forward<Graph>(g));
    }
};

//! @internal Functor returning a set of the vertices adjacent to a vertex.
struct get_unique_adjacent_vertices {
    template <typename Sig>
    struct result;

    template <typename This, typename Vertex, typename Graph>
    struct result<This(Vertex, Graph)> {
        typedef std::set<typename remove_reference<Vertex>::type> type;
    };
Exemple #18
0
// Copyright (c) 2007-2013 Hartmut Kaiser
// Copyright (c) 2012-2013 Thomas Heller
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


namespace hpx
{
    
    
    template <typename F>
    bool apply(threads::executor& sched, BOOST_FWD_REF(F) f)
    {
        sched.add(boost::forward<F>(f), "hpx::apply");
        return false; 
    }
    template <typename F>
    typename boost::enable_if_c<
        traits::detail::is_callable_not_action<F()>::value
     && !traits::is_bound_action<typename util::decay<F>::type>::value
      , bool
    >::type
    apply(BOOST_FWD_REF(F) f)
    {
        threads::register_thread_nullary(
            util::deferred_call(
                boost::forward<F>(f)
Exemple #19
0
    yield_result_type yield_impl(arg0_type arg0)
    {
      HPX_ASSERT(m_pimpl);

      this->m_pimpl->bind_result(&arg0);
      {
        reset_self_on_exit on_exit(this);
        this->m_pimpl->yield();
      }

      return *m_pimpl->args();
    }

    template <typename F>
    yield_decorator_type decorate_yield(BOOST_FWD_REF(F) f)
    {
        yield_decorator_type tmp(boost::forward<F>(f));
        std::swap(tmp, yield_decorator_);
        return boost::move(tmp);
    }

    yield_decorator_type decorate_yield(yield_decorator_type const& f)
    {
        yield_decorator_type tmp(f);
        std::swap(tmp, yield_decorator_);
        return boost::move(tmp);
    }

    yield_decorator_type decorate_yield(BOOST_RV_REF(yield_decorator_type) f)
    {
Exemple #20
0
#endif
#if HPX_THREAD_MAINTAIN_DESCRIPTION
            description(rhs.description),
#endif
#if HPX_THREAD_MAINTAIN_PARENT_REFERENCE
            parent_locality_id(rhs.parent_locality_id), parent_id(rhs.parent_id),
            parent_phase(rhs.parent_phase),
#endif
            priority(rhs.priority),
            num_os_thread(rhs.num_os_thread),
            stacksize(rhs.stacksize),
            scheduler_base(rhs.scheduler_base)
        {}

        template <typename F>
        thread_init_data(BOOST_FWD_REF(F) f, char const* desc,
                naming::address::address_type lva_ = 0,
                thread_priority priority_ = thread_priority_normal,
                std::size_t os_thread = std::size_t(-1),
                std::ptrdiff_t stacksize_ = std::ptrdiff_t(-1),
                policies::scheduler_base* scheduler_base_ = 0)
          : func(boost::forward<F>(f)),
#if HPX_THREAD_MAINTAIN_TARGET_ADDRESS
            lva(lva_),
#endif
#if HPX_THREAD_MAINTAIN_DESCRIPTION
            description(desc),
#endif
#if HPX_THREAD_MAINTAIN_PARENT_REFERENCE
            parent_locality_id(0), parent_id(0), parent_phase(0),
#endif
Exemple #21
0
    >::other::pointer internal_node_pointer;

    typedef typename Allocator::template rebind<
        typename node<Value, Parameters, Box, allocators, node_s_mem_dynamic_tag>::type
    >::other node_allocator_type;

    inline allocators()
        : node_allocator_type()
    {}

    template <typename Alloc>
    inline explicit allocators(Alloc const& alloc)
        : node_allocator_type(alloc)
    {}

    inline allocators(BOOST_FWD_REF(allocators) a)
        : node_allocator_type(pdalboost::move(a.node_allocator()))
    {}

    inline allocators & operator=(BOOST_FWD_REF(allocators) a)
    {
        node_allocator() = pdalboost::move(a.node_allocator());
        return *this;
    }

#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
    inline allocators & operator=(allocators const& a)
    {
        node_allocator() = a.node_allocator();
        return *this;
    }
Exemple #22
0
     void operator()(void ** p) const
     {
         T * t = new T();
         *p = t;
     }
     template <typename Archive>
     void serialize(Archive &, unsigned)
     {}
 };
 template <typename T, typename A0>
 struct ctor_fun<T, A0>
 {
     typedef void result_type;
     ctor_fun() {}
     template <typename Arg0>
     ctor_fun(BOOST_FWD_REF(Arg0) arg0)
         : a0(boost::forward<Arg0>(arg0))
     {}
     ctor_fun(BOOST_COPY_ASSIGN_REF(ctor_fun) rhs)
         : a0(rhs. a0)
     {}
     ctor_fun(BOOST_RV_REF(ctor_fun) rhs)
         : a0(boost::move(rhs. a0))
     {}
     ctor_fun& operator=(BOOST_COPY_ASSIGN_REF(ctor_fun) rhs)
     {
         if (this != &rhs) {
             a0 = rhs.a0;
         }
         return *this;
     }
Exemple #23
0
      : first(p.first), second(p.second)
   {}

   template <class D, class S>
   pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
      : first(::lslboost::move(p.first)), second(::lslboost::move(p.second))
   {}

   //pair from two values
   pair(const T1 &t1, const T2 &t2)
      : first(t1)
      , second(t2)
   {}

   template<class U, class V>
   pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v)
      : first(::lslboost::forward<U>(u))
      , second(::lslboost::forward<V>(v))
   {}

   //And now compatibility with std::pair
   pair(const std::pair<T1, T2>& x)
      : first(x.first), second(x.second)
   {}

   template <class D, class S>
   pair(const std::pair<D, S>& p)
      : first(p.first), second(p.second)
   {}

   pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p)
Exemple #24
0
// Copyright (c) 2007-2013 Hartmut Kaiser
// Copyright (c) 2012-2013 Thomas Heller
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


namespace hpx
{
    
    template <typename T0>
    lcos::unique_future<HPX_STD_TUPLE<typename util::decay<T0>::type> >
    when_n(std::size_t n, BOOST_FWD_REF(T0) f0,
        error_code& ec = throws)
    {
        typedef HPX_STD_TUPLE<
            typename util::decay<T0>::type>
            result_type;
        result_type lazy_values(detail::when_acquire_future<T0>()(f0));
        if (n == 0)
        {
            return lcos::make_ready_future(boost::move(lazy_values));
        }
        if (n > 1)
        {
            HPX_THROWS_IF(ec, hpx::bad_parameter,
                "hpx::lcos::when_n",
                "number of results to wait for is out of bounds");
Exemple #25
0
    // forward declare the required overload of apply.
    template <typename Component, typename Result, typename Arguments,
        typename Derived, typename Arg>
    inline bool
    apply(hpx::actions::action<Component, Result, Arguments, Derived>,
        naming::id_type const&, BOOST_FWD_REF(Arg));

    // MSVC complains about async_continue beeing ambiguous if it sees this
    // forward declaration
    template <typename F, typename Arg1, typename Arg2>
    inline typename boost::enable_if_c<
        traits::detail::is_callable_not_action<F(Arg1, Arg2)>::value
     && !traits::is_bound_action<typename util::decay<F>::type>::value
      , bool
    >::type
    apply(BOOST_FWD_REF(F) f, BOOST_FWD_REF(Arg1), BOOST_FWD_REF(Arg2));

    template <typename Component, typename Result, typename Arguments,
        typename Derived, typename Arg0, typename F>
    inline typename boost::enable_if_c<
        util::tuple_size<Arguments>::value == 1,
        bool
    >::type
    apply_continue(hpx::actions::action<Component, Result, Arguments, Derived>,
        naming::id_type const& gid, BOOST_FWD_REF(Arg0) arg0,
        BOOST_FWD_REF(F) f);

    template <typename Component, typename Result, typename Arguments,
        typename Derived, typename Arg0>
    inline bool
    apply_c(hpx::actions::action<Component, Result, Arguments, Derived>,
// This file has been automatically generated using the Boost.Wave tool.
// Do not edit manually.


        
    template <typename This, typename U0>
    struct result<This(U0)>
      : bind_invoke_impl<
            F, BoundArgs
          , util::tuple<typename util::add_rvalue_reference<U0>::type>
        >
    {};
    template <typename U0>
    BOOST_FORCEINLINE
    typename result<bound(U0)>::type
    operator()(BOOST_FWD_REF(U0) u0)
    {
        return
            detail::bind_invoke(
                _f, _bound_args
              , util::forward_as_tuple(boost::forward<U0>( u0 ))
            );
    }
    template <typename This, typename U0>
    struct result<This const(U0)>
      : bind_invoke_impl<
            F const, BoundArgs const
          , util::tuple<typename util::add_rvalue_reference<U0>::type>
        >
    {};
    template <typename U0>
Exemple #27
0
    boost::shared_ptr<Filesystem> repository_;
    detail::mutex mutable repository_lock_;
    typedef boost::lock_guard<detail::mutex> scoped_lock;

    boost::shared_ptr<Filesystem> get_repository() {
        scoped_lock lock(repository_lock_);
        return repository_;
    }

public:
    FilesystemDispatcher()
        : repository_()
    { }

    template <typename Path>
    explicit FilesystemDispatcher(BOOST_FWD_REF(Path) root)
        : repository_(boost::make_shared<Filesystem>(
                          root, dyno::filesystem_overwrite))
    { }

    /**
     * Set a new repository for the event dispatcher. If setting the
     * repository fails, an exception is thrown.
     *
     * @note The method offers the strong exception safety guarantee. If
     *       setting the repository fails, the repository is left unmodified
     *       (as-if the call never happened) and logging continues in the same
     *       repository as before the call.
     */
    template <typename Path>
    void set_repository(BOOST_FWD_REF(Path) new_root) {
Exemple #28
0
//! @internal Tag signalling the end of a chain of `aggregate_cell`s.
struct last_in_chain DYNO_DOXYGEN_FORWARD_DECL;

//! @internal Cell optimized for holding an aggregate type.
template <typename Tag, typename Data, typename Next>
struct aggregate_cell {
    typedef Tag tag_type;
    typedef Next next_type;
    typedef Data data_type;

    data_type data;
    next_type next;

    template <typename ThisData, typename ...MoreData>
    static aggregate_cell
    create(BOOST_FWD_REF(ThisData) data, BOOST_FWD_REF(MoreData) ...more) {
        aggregate_cell cell = {
            boost::forward<ThisData>(data),
            Next::create(boost::forward<MoreData>(more)...)
        };
        return cell;
    }
};

/*!
 * @internal
 * Specialization of `aggregate_cell` for the last cell in the chain.
 *
 * It does not have a `Next` member.
 */
template <typename Tag, typename Data>
Exemple #29
0
    template <typename F, typename ResultOf = std::result_of<F> >
    struct create_future
    {
        typedef lcos::future<typename ResultOf::type> type;
    };
#else
    template <typename F, typename ResultOf = boost::result_of<F> >
    struct create_future
    {
        typedef lcos::future<typename ResultOf::type> type;
    };
#endif

    template <typename F>
    BOOST_FORCEINLINE typename detail::create_future<F()>::type
    call_sync(BOOST_FWD_REF(F) f, boost::mpl::false_)
    {
        return make_ready_future(f());
    }

    template <typename F>
    BOOST_FORCEINLINE typename detail::create_future<F()>::type
    call_sync(BOOST_FWD_REF(F) f, boost::mpl::true_)
    {
        f();
        return make_ready_future();
    }
}}

#if !defined(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
#  include <hpx/preprocessed/async.hpp>
Exemple #30
0
///////////////////////////////////////////////////////////////////////////////
namespace hpx
{
    ///////////////////////////////////////////////////////////////////////////
    class HPX_EXPORT thread
    {
        typedef lcos::local::spinlock mutex_type;

    public:
        class id;
        typedef threads::thread_id_type native_handle_type;

        thread() BOOST_NOEXCEPT;

        template <typename F>
        explicit thread(BOOST_FWD_REF(F) f)
          : id_(threads::invalid_thread_id)
        {
            start_thread(boost::move(HPX_STD_FUNCTION<void()>(boost::forward<F>(f))));
        }

// #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
//         template <typename F, typename ...Args>
//         explicit thread(F&& f, Args&&... args)
//         {
//             start_thead(HPX_STD_BIND(f, boost::forward<Args...>(args)));
//         }
// #else
        // Vertical preprocessor repetition to define the remaining constructors
#define BOOST_PP_ITERATION_PARAMS_1                                           \
    (3, (1, HPX_FUNCTION_ARGUMENT_LIMIT, <hpx/runtime/threads/thread.hpp>))   \