Created
          January 25, 2017 14:00 
        
      - 
      
- 
        Save fernandoc1/0df7be2a53282cc31d6b7bab1a46a7bc to your computer and use it in GitHub Desktop. 
    Example for using serializing and deserializing map with DLIB
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <iostream> | |
| #include <fstream> | |
| #include <map> | |
| #include <dlib/serialize.h> | |
| int main() | |
| { | |
| std::map<std::string, std::string> dict; | |
| //dict["A"] = "a"; | |
| //dict["B"] = "b"; | |
| //dict["ABCDE"] = "abcde"; | |
| //std::ofstream output; | |
| //output.open("file.out"); | |
| //dlib::serialize(dict, output); | |
| std::ifstream input("file.out"); | |
| dlib::deserialize(dict, input); | |
| std::cout << dict["ABCDE"] << std::endl; | |
| return 0; | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | all: | |
| g++ main.cpp -ldlib -o Test | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment