abseilのサンプルコードをビルドする(abseil-cppのabsl::StrJoin()を試す)


Setup

sudo apt-get install clang
sudo apt-get install git
git clone https://github.com/abseil/abseil-cpp.git

Sample Source Code

join.cpp
// from https://abseil.io/docs/cpp/quickstart

#include <iostream>
#include <string>
#include <vector>
#include "absl/strings/str_join.h"

int main()
{
  std::vector<std::string> v = {"失礼", "熱盛と", "出てしまいました"};
  std::string s = absl::StrJoin(v, "、");

  std::cout << "Joined string: " << s << "\n";

  return(0);
}

Build and Run

ROOT=.
clang++ -Wall -Wextra -std=c++11 -I "${ROOT}/abseil-cpp" join.cpp
./a.out

Output

Joined string: 失礼、熱盛と、出てしまいました

References

Thumbnail