HPX - High Performance ParalleX

PrevUpHomeNext

Function template new_

hpx::new_ — Create one or more new instances of the given Component type on the specified locality.

Synopsis

// In header: <hpx/runtime/components/new.hpp>


template<typename Component, typename... Ts> 
  < unspecified > new_(id_type const & locality, Ts &&... vs);

Description

This function creates one or more new instances of the given Component type on the specified locality and returns a future object for the global address which can be used to reference the new component instance.

[Note] Note

This function requires to specify an explicit template argument which will define what type of component(s) to create, for instance:

hpx::future<hpx::id_type> f =
   hpx::new_<some_component>(hpx::find_here(), ...);
hpx::id_type id = f.get();

Parameters:

locality

[in] The global address of the locality where the new instance should be created on.

vs

[in] Any number of arbitrary arguments (passed by value, by const reference or by rvalue reference) which will be forwarded to the constructor of the created component instance.

Returns:

The function returns different types depending on its use:

  • If the explicit template argument Component represents a component type (traits::is_component<Component>::value evaluates to true), the function will return an hpx::future object instance which can be used to retrieve the global address of the newly created component.

  • If the explicit template argument Component represents a client side object (traits::is_client<Component>::value evaluates to true), the function will return a new instance of that type which can be used to refer to the newly created component instance.


PrevUpHomeNext