close
Espacios de nombres
Variantes

std::hash (std::bitset)

De cppreference.com
 
 
Biblioteca de servicios
 
std::bitset
Tipos de miembros
Original:
Member types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Las funciones miembro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Elemento acceso
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Capacidad
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Modificadores
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversiones
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Terceros funciones
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Clases de ayuda
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
 
<tbody> </tbody>
template<size_t N> struct hash<bitset<N>>;
(desde C++11)
La especialización de plantilla de std::hash para std::bitset<N> permite a los usuarios obtener los valores hash de los objetos de tipo std::bitset<N> .
Original:
The template specialization of std::hash for std::bitset<N> allows users to obtain hashes of objects of type std::bitset<N>.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Ejemplo

El código siguiente muestra una posible salida de una función hash utilizado en varios bitsets:
Original:
The following code shows one possible output of a hash function used on several bitsets:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <bitset>
#include <functional>
 
int main()
{
    std::bitset<4> b1(1);
    std::bitset<4> b2(2);
    std::bitset<4> b3(b2);

    std::hash<std::bitset<4>> hash_fn;

    size_t h1 = hash_fn(b1);
    size_t h2 = hash_fn(b2);
    size_t h3 = hash_fn(b3);

    std::cout << h1 << '\n';
    std::cout << h2 << '\n';
    std::cout << h3 << '\n';
}

Salida:

67918732
118251589
118251589

Ver también

(C++11)
Objeto función de dispersión (hash).
(plantilla de clase) [editar]