|
Boost Users : |
Subject: [Boost-users] [filesystem] Custom memory allocator
From: Dominic Vandot (Dom.Van.dot_at_[hidden])
Date: 2010-04-28 16:13:32
All,
I'd like to use filesystem::path with a custom memory allocator (I need to
allocate and free millions of paths in cycles from multiple threads). As far
as I understand only the underlying string type can have a custom allocator.
I created these typedefs:
typedef basic_string<char, char_traits<char>, tbb::scalable_allocator<char>
> fast_string;
struct fast_path_traits;
typedef fs::basic_path<fast_string, fast_path_traits> fast_path;
struct fast_path_traits {
typedef fast_string internal_string_type;
typedef fast_string external_string_type;
static external_string_type to_external( const fast_path &,
const internal_string_type & src ) { return src; }
static internal_string_type to_internal(
const external_string_type & src ) { return src; }
};
typedef basic_directory_iterator<fast_path> fast_directory_iterator;
Everything compiles until the point where I'd use operations:
d = file_size<fast_path>(itr->path());
I get this error under VS2009:
error C2770: invalid explicit template argument(s) for
'boost::enable_if<boost::filesystem::is_basic_path<Path>,boost::uintmax_t>::type
boost::filesystem::file_size(const Path &)'
Please help correcting it.
Thanks,
Dominic
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net