With the code that follows, I want to create a map of type std::map<std::string,uint_fast64_t>. By using a debugger, I got that the exception was raised by stl_pair.h at line 368 (pair& operator=(typename conditional<__and_<is_copy_assignable<_T1>, is_copy_assignable<_T2>>::value, const pair&, const __wrap_nonesuch&>::type __p)), which was invoked by the map scanning of cur (*(cur + 1) = *cur;) in the leaf.h insert function of stxxl. I provide the code I used in the following source code:
#include<stxxl/map>#include<fstream>#include<string>#include<cstdint>typedefuint_fast64_tLONG_NUMERIC;std::stringrandom_string(size_tlength){autorandchar=[]()->char{constcharcharset[]="0123456789""ABCDEFGHIJKLMNOPQRSTUVWXYZ""abcdefghijklmnopqrstuvwxyz";constsize_tmax_index=(sizeof(charset)-1);returncharset[rand()%max_index];};std::stringstr(length,0);std::generate_n(str.begin(),length,randchar);returnstr;}structCompareGreater22{booloperator()(conststd::string&a,conststd::string&b)const{returna>b;}staticstd::stringmax_value(){returnstd::string();}};intmain(intargc,char**argv){stxxl::config*cfg=stxxl::config::get_instance();stxxl::disk_configdisk1("/mnt/DEC4763AC47614CD/stxxl.tmp",100*1024*1024,"syscall unlink");disk1.direct=stxxl::disk_config::DIRECT_ON;// force O_DIRECT// add disk to configcfg->add_disk(disk1);// template parameter <KeyType, DataType, CompareType, RawNodeSize, RawLeafSize, PDAllocStrategy (optional)>typedefstxxl::map<std::string,LONG_NUMERIC,CompareGreater22,DATA_NODE_BLOCK_SIZE,DATA_LEAF_BLOCK_SIZE>map_type3;// Constructor map(node_cache_size_in_bytes, leaf_cache_size_in_bytes)map_type3t((map_type3::node_block_type::raw_size)*3,(map_type3::leaf_block_type::raw_size)*3);//vertex_conversion_map_type t{(vertex_conversion_map_type::node_block_type::raw_size)*3, (vertex_conversion_map_type::leaf_block_type::raw_size)*3};for(LONG_NUMERICi=0;i<2000;i++){t.insert(std::make_pair(random_string(10),i));}}
With the code that follows, I want to create a map of type std::map<std::string,uint_fast64_t>. By using a debugger, I got that the exception was raised by stl_pair.h at line 368 (
pair& operator=(typename conditional<__and_<is_copy_assignable<_T1>, is_copy_assignable<_T2>>::value, const pair&, const __wrap_nonesuch&>::type __p)
), which was invoked by the map scanning of cur (*(cur + 1) = *cur;
) in the leaf.h insert function of stxxl. I provide the code I used in the following source code:I also provide the dump result: