I'm new to ICL and have a few questions and a problem. Here is my test code which demonstrated (Windows, MSVC 2012):
// "icl_question.cpp"
#include "precomp.hpp"
#include <iostream>
#include <utility>
#include <functional>
#include
#include
#include
typedef boost::icl::closed_intervalboost::uint16_t interval_t;
// Based on the in "boost/icl/functors.hpp".
template <typename Type> struct inplace_assign
: public boost::icl::identity_based_inplace_combine<Type>
{
typedef inplace_assign<Type> type;
void operator()(Type& object, const Type& operand) const
{
object = operand;
}
};
// Why is the 7 template parameter not a template template parameter?
// The code in "boost/icl/detail/design_config.hpp" does not define the
// ICL_USE_INTERVAL_TEMPLATE_TYPE macro (I assume intentionally) which, if
// defined, would make it so.
typedef boost::icl::interval_map
<
boost::uint16_t,
const char*,
boost::icl::partial_absorber,
std::less,
inplace_assign,
boost::icl::inter_section,
interval_t
> map_t;
int main(int argc, char *argv[])
{
using namespace std;
map_t mem;
// The commented line two down is what I intend, but it asserts at
runtime.
// This one works.
mem += make_pair(interval_t(0, 0xfffe), "RAM");
//mem += make_pair(interval_t(0, 0xffff), "RAM");
mem += make_pair(interval_t(0xa000, 0xbfff), "Basic ROM");
cout << hex << mem << endl;
return 0;
}
The first question is about the aggregate on collision functionality. I would just like to replace. I have implemented *inplace_assign *which does this but it seems strange that this isn't included. Am I missing something here (I fear I may well be)? The second question is why* interval_map*'s 7th template parameter ( *Interval*) is not a template template parameter. The code in "boost/icl/detail/design_config.hpp" does not define the *ICL_USE_INTERVAL_TEMPLATE_TYPE *macro (I assume intentionally) which, if defined, would make it so. The third question is about a runtime error I'm getting in the above code. The comment in *main *shows the scenario. Basically if I use *0xffff *as the end of the first range I get an ASSERT at runtime whereas 0xfffe works fine. Finally, the documentation seems a little sparse on the function of the *Section* template parameter. Any clarification on that would be appreciated.