c++ - template template parameters with boost::fast_pool_allocator -


why doesn't compile:

std::map<int, int, std::less<int>, boost::fast_pool_allocator< std::pair< int, int > > a_test; 

but compiles fine:

typedef boost::fast_pool_allocator< std::pair< int, int > > fast_alloc; std::map<int, int, std::less<int>, fast_alloc > a_test; 

a separate question: far can see in definition of boost::fast_pool_allocator takes 4 non-defaulted template parameters, in example above works fine. can please explain reason this? thanks!

your definition should read

std::map<   int,   int,   std::less<int>,   boost::fast_pool_allocator<     std::pair< int, int >   > > a_test; 

you should format longer template instantiations parameters on separate lines. way cannot miss closing brackets.

boost::fast_pool_allocator forward-declared default template parameters in poolfwd.hpp.

just clarify naming conventions: allocator parameter not template template parameter here since specify setting type std::pair<int, int>.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -