0
点赞
收藏
分享

微信扫一扫

SpringBoot基于Zookeeper实现分布式锁

小亦同学321 2023-08-19 阅读 46

简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长!

优质专栏:Audio工程师进阶系列原创干货持续更新中……】🚀

人生格言: 人生从来没有捷径,只有行动才是治疗恐惧和懒惰的唯一良药.

更多原创,欢迎关注:Android系统攻城狮

欢迎关注Android系统攻城狮

1.前言

v1.0

#include <iostream>
#include <utility>
#include <cstdint>

typedef std::pair<uint64_t, size_t> MapperKey;

int main(){
  MapperKey key(123456789, 10);

  std::cout << "MapperKey: " << key.first << ", " << key.second << std::endl;

  return 0;
}

v2.0

#include <iostream>
#include <utility>
#include <cstdint>
#include <vector>

typedef std::pair<uint64_t, size_t> MapperKey;

int main(){
  std::vector<MapperKey> keys;

  MapperKey key1(123456789, 10);
  MapperKey key2(987654321, 20);
  MapperKey key3(555555555, 15);

  keys.push_back(key1);
  keys.push_back(key2);
  keys.push_back(key3);

  std::cout << "Iterating through MapperKeys:" << std::endl;
  for (const MapperKey& key : keys)
    {
      std::cout << "Key: " << key.first << ", " << key.second << std::endl;
    }

  return 0;
}
举报

相关推荐

0 条评论