FairMQ  1.4.14
C++ Message Queuing Library and Framework
Strings.h
1 /********************************************************************************
2  * Copyright (C) 2017 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
9 #ifndef FAIR_MQ_TOOLS_STRINGS_H
10 #define FAIR_MQ_TOOLS_STRINGS_H
11 
12 #include <array>
13 #include <initializer_list>
14 #include <sstream>
15 #include <string>
16 #include <vector>
17 
18 namespace fair
19 {
20 namespace mq
21 {
22 namespace tools
23 {
24 
28 template<typename ... T>
29 auto ToString(T&&... t) -> std::string
30 {
31  std::stringstream ss;
32  (void)std::initializer_list<int>{(ss << t, 0)...};
33  return ss.str();
34 }
35 
37 inline auto ToStrVector(const int argc, char*const* argv, const bool dropProgramName = true) -> std::vector<std::string>
38 {
39  if (dropProgramName) {
40  return std::vector<std::string>(argv + 1, argv + argc);
41  } else {
42  return std::vector<std::string>(argv, argv + argc);
43  }
44 }
45 
46 } /* namespace tools */
47 } /* namespace mq */
48 } /* namespace fair */
49 
50 #endif /* FAIR_MQ_TOOLS_STRINGS_H */
Tools for interfacing containers to the transport via polymorphic allocators.
Definition: DeviceRunner.h:23

privacy