There are multiple answers based on what you are doing with the string.

1) Using the string as an id (will not be modified). Passing it in by const reference is probably the best idea here: (std::string const&)

2) Modifying the string but not wanting the caller to see that change. Passing it in by value is preferable: (std::string)

3) Modifying the string but wanting the caller to see that change. Passing it in by reference is preferable: (std::string &)

4) Sending the string into the function and the caller of the function will never use the string again. Using move semantics might be an option (std::string &&)

最新文章

  1. JAVA学习笔记(二):eclipse智能提示(转)
  2. 锋利的jQuery-5--下拉框的应用(看写法)
  3. COM/ATL 资料收集
  4. Gem5全系统模式下运行SPLASH-2 Benchmarks使用alpha ISA
  5. uva 11186 Circum Triangle<叉积>
  6. 百度之星A
  7. Spring面向切面编程(AOP,Aspect Oriented Programming)
  8. SecureCRT自动断开连接的问题
  9. 《A First Course in Probability》-chaper8-极限定理-切比雪夫不等式
  10. 沙湖王 | 用Scipy实现K-means聚类算法
  11. 栅栏cyclicbarrier
  12. java 线程之concurrent中的常用工具 CyclicBarrier
  13. 为什么eclipse修改程序之后运行的时候还是前一版本的内容?
  14. Android 开发笔记___textview_聊天室效果
  15. django处理cookie的机制
  16. 安装Office2010出现MSXML版本6.10.1129.0错误
  17. Linux任务计划命令 :crontab -e
  18. windows下数据挖掘相关包numpy、pandas的安装
  19. 1.8 新特性之 Lambda Expressions
  20. Webpack 概念

热门文章

  1. Python记录键盘鼠标敲击次数
  2. java中反射的基本使用
  3. nginx的docker化部署
  4. Linux-3.5-Exynos4412驱动分层分离
  5. django基本配置项-5
  6. 『Python基础-6』if语句, if-else语句
  7. 【转】I2C总线相关知识
  8. To Support High-Density Retina Displays
  9. 成都Uber优步司机奖励政策(1月24日)
  10. Android AOSP 单独编译某一模块