1 Star 0 Fork 121

blog/kbengine

forked from likecg/kbengine 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
inplace.hpp 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
kbengine-srv 提交于 2014-03-10 16:21 +08:00 . 更新boost到1_55
// Copyright (C) 2005-2006 Alain Miniussi <alain.miniussi -at- oca.eu>.
// Use, modification and distribution is subject to 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)
// Message Passing Interface 1.1 -- Section 4. MPI Collectives
/** @file inplace.hpp
*
* This header provides helpers to indicate to MPI collective operation
* that a buffer can be use both as an input and output.
*/
#ifndef BOOST_MPI_INPLACE_HPP
#define BOOST_MPI_INPLACE_HPP
#include <boost/mpi/communicator.hpp>
#include <vector>
namespace boost { namespace mpi {
/**
* @brief Wrapper type to explicitly indicate that a input data
* can be overriden with an output value.
*/
template <typename T>
struct inplace_t {
inplace_t(T& inout) : buffer(inout) {}
T& buffer;
};
template <typename T>
struct inplace_t<T*> {
inplace_t(T* inout) : buffer(inout) {}
T* buffer;
};
/**
* @brief Wrapp a input data to indicate that it can be overriden
* with an ouput value.
* @param inout the contributing input value, it will be overriden
* with the output value where one is expected. If it is a pointer,
* the number of elements will be provided separatly.
* @returns The wrapped value or pointer.
*/
template<typename T>
inplace_t<T>
inplace(T& inout) {
return inplace_t<T>(inout);
}
/**
* \overload
*/
template<typename T>
inplace_t<T*>
inplace(T* inout) {
return inplace_t<T*>(inout);
}
} } // end namespace boost::mpi
#endif // BOOST_MPI_INPLACE_HPP
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/blog/kbengine.git
git@gitee.com:blog/kbengine.git
blog
kbengine
kbengine
0.1.2

搜索帮助