get_process_id_name.hpp

来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 50 行

HPP
50
字号
////////////////////////////////////////////////////////////////////////////////// (C) Copyright Ion Gaztanaga 2004-2007. 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)//// See http://www.boost.org/libs/interprocess for documentation.////////////////////////////////////////////////////////////////////////////////#ifndef BOOST_INTERPROCESS_GET_PROCESS_ID_NAME_HPP#define BOOST_INTERPROCESS_GET_PROCESS_ID_NAME_HPP#include <boost/config.hpp>#include <string>    //std::string#include <sstream>   //std::stringstream#include <boost/interprocess/detail/os_thread_functions.hpp>namespace boost{namespace interprocess{namespace test{inline void get_process_id_name(std::string &str){   std::stringstream sstr;   sstr << "process_" << boost::interprocess::detail::get_current_process_id();   str = sstr.str();}inline const char *get_process_id_name(){   static std::string str;   get_process_id_name(str);   return str.c_str();}inline const char *add_to_process_id_name(const char *name){   static std::string str;   get_process_id_name(str);   str += name;   return str.c_str();}}  //namespace test{}  //namespace interprocess{}  //namespace boost{#endif //#ifndef BOOST_INTERPROCESS_GET_PROCESS_ID_NAME_HPP

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?