I need to declare a boost::array. I did it as boost::array<char, 116> buf;
is there a possibility that I can declare with the size stored as a con开发者_运维百科stant that is initialized from property file. something like boost::array<char, BUFFER_SIZE> buf;
Any Help?
No. If you want a dynamically sizable array, use a std::vector
Reason for No is that the template parameter cannot be provided at run time (caveat: current standard)
If it's a constant available at compile-time, (meaning you #included your property file or something) then yes.
int const BUFFER_SIZE = 116;
boost::array<char, BUFFER_SIZE> buf;
is valid. If it isn't available at compile-time, then no.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论