Is it valid, to use std::string to hold binary data, to avoid manual dynamic memory management

后端 未结 5 1803
醉话见心
醉话见心 2021-02-05 00:55

Pay attention to base64_decode in http://www.adp-gmbh.ch/cpp/common/base64.html

std::string base64_decode(std::string const& encoded_string)
         


        
5条回答
  •  爱一瞬间的悲伤
    2021-02-05 01:50

    I don't think it's completely valid. Care must be taken with string and binary data because it uses internally char type and char depends in the implementation if it is defined as unsigned or signed type. I prefer to use basic_string and be sure of what i'm reading.

提交回复
热议问题