ROOT execute make_pair function error

Hi
Can ROOT identify make_pair function? I have a simple test code as following

#include <iostream>
#include   <map> 
#include <vector>
int main()
{
     std::map<std::string,std::vector<double> > fHitPositionsXZ;	//!
     std::string key="ccc";
     std::vector<double> vec;
     fHitPositionsXZ.insert(std::make_pair(key, vec));
     fHitPositionsXZ[key].push_back(1);
     fHitPositionsXZ[key].push_back(2);
     fHitPositionsXZ[key].push_back(3);
     std::map<std::string,std::vector<double> >::iterator it;
    for(it=fHitPositionsXZ.begin();it!=fHitPositionsXZ.end();++it)
        std::cout<<"key: "<<it->first <<" value: "<<(it->second)[1]<<std::endl;
return 0;
}

g++ 4.8.5 can compile it fine. But if I change int main() to void hist()(file name) and execute it in ROOT, it has error like this

root [0] .x hist.c

 *** Break *** segmentation violation



===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0  0x00007f6b5ab597ea in __GI___waitpid (pid=25467, stat_loc=stat_loc
entry=0x7fffc2c5a880, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1  0x00007f6b5aad2ffb in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f6b5b889c53 in TUnixSystem::StackTrace() () from /home/zhao/root/lib/libCore.so
#3  0x00007f6b5b88b95c in TUnixSystem::DispatchSignals(ESignals) () from /home/zhao/root/lib/libCore.so
#4  <signal handler called>
#5  0x00007f6b5b14075b in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

This is the first few lines. I make sure that ROOT crashes in the line make_pair appears. What is the problem? In fact, I have a dumb question here. What interpreter does ROOT use to compile and execute? I have ROOT 5.34/28

Hi,

make_pair is a template function and it could be that with a dictionary you could cover the cases of your application.
On the other hand ROOT6 solves this problem elegantly and out of the box.
My recommendation would be to move to ROOT6.

Cheers,
Danilo

If you want to stay with ROOT 5, use ACLiC (i.e. “precompile” your macro):
root [0] .x hist.c++
BTW. for “std::string” you should #include and for “std::make_pair” you should #include