boost::string_ref basic container like function














































boost::string_ref basic container like function



#include<boost/utility/string_ref.hpp>
#include<iostream>
#include<string>
using namespace std; 
  int main() { 
  boost::string_ref str = "CPPSECRETS.COM";
  boost::string_ref v = str; 
  /*functions return the size of str_ref*/ 
  std::cout<<v.size()<<endl; 
  std::cout<<v.length()<<endl; 
  std::cout<<v.max_size()<<endl; 
  /* function return 1 when str_ref is empty and 0 if it is not empty*/ 
  std::cout<<v.empty()<<endl;
  return 0; 
  }
output:
14
14
14
0


Comments