Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ C ++ string in the end     - Linux, MySQL root privilege escalation another method (Linux)

- Development environment to build MEAN In Ubuntu 15.10 (Server)

- System Safety: Windows and Linux platforms (Linux)

- Use MySQL optimization of security to prevent misuse of aliases (Database)

- PostgreSQL vacuum principle of a function and parameters (Database)

- Linux network security backdoor technology and advanced skill practice (Linux)

- OpenSIPS offline messaging feature set (Server)

- Python console achieve progress bar (Programming)

- PostgreSQL log classification and management (Database)

- MySQL backup tool to back up mydumper (Database)

- Intel Graphics Installer installation on Ubuntu 15.10 (Linux)

- JavaScript in this usage (Programming)

- Vim useful plugin: EasyGrep (Linux)

- Ubuntu system cp: omitting directory problem (Linux)

- Seven Steps to Help Google Chrome Speed - (Linux)

- Precautions against hackers Linux environment (Linux)

- Upgrading KDE Plasma 5.3 in Ubuntu 15.04 (Linux)

- Ubuntu 14.04 install AMD graphics driver is fully dual monitor solution (Linux)

- To install Cinnamon desktop environment on your Ubuntu 14.04 / 12.04 (Linux)

- Ubuntu firewall installation and configuration (Linux)

 
         
  C ++ string in the end
     
  Add Date : 2018-11-21      
         
         
         
  C ++ string in the end is what?

To answer this question, one should first understand what is basic_string.
Look basic_string statement:

template < class charT, // type definition characters in a string
          class traits = char_traits < charT>, // basic_string :: traits_type
          class Alloc = allocator < charT> // basic_string :: allocator_type
          > Class basic_string;

Visible, basic_string class is essentially a template.
Then explain a little more detail:

1. About char_traits

statement:

template < class charT> struct char_traits;

effect:

Character traits classes specify character properties and provide specific semantics for certain operations on characters and sequences of characters. (From C ++ Referencce, address: http: //www.cplusplus.com/reference/string/char_traits/)

That is: it specifies the attribute of the character, and provides specific semantic role in the characters or character sequences of certain operations.

2. About allocator

statement:

template < class T> class allocator; // at < memory> header file allocator: Splitter

effect:
Allocators are classes that define memory models to be used by some parts of the Standard Library, and most specifically, by STL containers (from C ++ Referencce, address:. Http: //www.cplusplus.com/reference/memory/allocator/? kw = allocator)
That is: It defines part of the standard library is used, in particular STL memory model.

Now let's string declaration:

typedef basic_string < char, char_traits < char>, allocator < char >> string;

Now, we understand, the original is such a thing:

With basic types char instantiate the class template basic_string, to give a specific template class, then, is it typedef string.

In other words, is essentially a template class string is basic_string < char, char_traits < char>, allocator < char >>, string is the corresponding "short." Intuitively understand, string instance of the object (that is string str; the str) is a char sequence, but unlike char * str, stingr str with many good package for their own operations.

ps: basic_string there are other examples, such as:

typedef basic_string < wchar_t, char_traits < wchar_t>, allocator < wchar_t >> wstring;
     
         
         
         
  More:      
 
- How to troubleshoot Windows and Ubuntu dual system time is not synchronized (Linux)
- Use apt-p2p up a local Debian package cache (Server)
- Help you make Git Bisect (Linux)
- Port is not being used, how will bind failure? (Server)
- Python extension module Ganglia 3.1.x (Linux)
- Java inheritance initialization problem (Programming)
- The Java development environment to build under Ubuntu 14.04 (Linux)
- Ubuntu 14.04 set auto sleep time (Linux)
- Use Nginx as a load balancer (Server)
- How to use SVN to manage our source code (Server)
- JavaScript function part (Programming)
- Linux System Getting Started Tutorial: permission to permanently modify the USB device in Linux (Linux)
- Install Unity 8 preview version of the desktop in Ubuntu (Linux)
- Towards Docker (Server)
- MySQL InnoDB table --BTree basic data structures (Database)
- Linux environment has been running Tomcat how to deploy the new Tomcat (Server)
- How to use Linux iptables tool for network sharing (Linux)
- Python 2 Chinese garbage problem solved (Linux)
- Use Linux firewall camouflage defense hacked (Linux)
- ASM required disk format process in Solaris platforms (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.