D
Dave
Hello all,
I hope the context to my problem shown below is adequate but not
overwhelming. I tried to keep it minimal.
At the line indicated (in comment form) in the source below, the following
error is occurring (VC++ 7.1):
error C2663: 'std::_Tree<_Traits>::find' : 2 overloads have no legal
conversion for 'this' pointer
In Comeau speak:
error: argument of type ... is incompatible with parameter of type ...
If I change part of the line in question to:
((T1 *) &node)
everything works fine (both platforms). However, I may not use the
C++-style casts here - failure still occurs in that case.
Does anybody have nay idea what might be going on?
Thanks,
Dave
// Class declaration:
template <int n>
class repeated_state_checker_t
{
public:
template <typename T1, typename T2>
bool seen_before(
const T1 &node,
const std::set<T1 *, T2> &all_nodes_sorted
) const;
};
// Definition of class full specialization:
template <>
class repeated_state_checker_t<4>
{
public:
template <typename T1, typename T2>
bool seen_before(
const T1 &node,
const std::set<T1 *, T2> &all_nodes_sorted
) const
{
if (all_nodes_sorted.find(&node) != all_nodes_sorted.end()) //
***** ERROR HERE *****
return true;
else
return false;
} // repeated_state_checker_t<4>::seen_before
};
// The class above is a template parameter to my main class; my main class
inherits from the
// template parameter and attempts to invoke the seen_before() method of the
base
// subobject as follows:
REPEATED_STATE_CHECKER::seen_before(
new_node,
all_nodes_sorted
)
// Definition of the type of new_node is shown below. This struct is
embedded in a class template and references
// some of that class template's template parameters.
struct node_t
{
node_t(
const STATE_T &state_p,
int depth_p,
int cost_to_reach_p,
const node_t *parent_p = NULL,
const OP_T &op_p = OP_T()
):
state(state_p),
depth(depth_p),
cost_to_reach(cost_to_reach_p),
parent(parent_p),
op(op_p)
{
}
STATE_T state;
int depth;
int cost_to_reach;
const node_t *parent; // Equals NULL for root node
OP_T op; // Meaningful only if parent !=
NULL
};
// Definition of all_nodes_sorted:
std::set<node_t *, node_sort_t> all_nodes_sorted;
// Definition of node_sort_t:
class node_sort_t
{
public:
bool operator()(const node_t *lhs, const node_t *rhs) const
{
return (lhs->state < rhs->state);
}
};
I hope the context to my problem shown below is adequate but not
overwhelming. I tried to keep it minimal.
At the line indicated (in comment form) in the source below, the following
error is occurring (VC++ 7.1):
error C2663: 'std::_Tree<_Traits>::find' : 2 overloads have no legal
conversion for 'this' pointer
In Comeau speak:
error: argument of type ... is incompatible with parameter of type ...
If I change part of the line in question to:
((T1 *) &node)
everything works fine (both platforms). However, I may not use the
C++-style casts here - failure still occurs in that case.
Does anybody have nay idea what might be going on?
Thanks,
Dave
// Class declaration:
template <int n>
class repeated_state_checker_t
{
public:
template <typename T1, typename T2>
bool seen_before(
const T1 &node,
const std::set<T1 *, T2> &all_nodes_sorted
) const;
};
// Definition of class full specialization:
template <>
class repeated_state_checker_t<4>
{
public:
template <typename T1, typename T2>
bool seen_before(
const T1 &node,
const std::set<T1 *, T2> &all_nodes_sorted
) const
{
if (all_nodes_sorted.find(&node) != all_nodes_sorted.end()) //
***** ERROR HERE *****
return true;
else
return false;
} // repeated_state_checker_t<4>::seen_before
};
// The class above is a template parameter to my main class; my main class
inherits from the
// template parameter and attempts to invoke the seen_before() method of the
base
// subobject as follows:
REPEATED_STATE_CHECKER::seen_before(
new_node,
all_nodes_sorted
)
// Definition of the type of new_node is shown below. This struct is
embedded in a class template and references
// some of that class template's template parameters.
struct node_t
{
node_t(
const STATE_T &state_p,
int depth_p,
int cost_to_reach_p,
const node_t *parent_p = NULL,
const OP_T &op_p = OP_T()
):
state(state_p),
depth(depth_p),
cost_to_reach(cost_to_reach_p),
parent(parent_p),
op(op_p)
{
}
STATE_T state;
int depth;
int cost_to_reach;
const node_t *parent; // Equals NULL for root node
OP_T op; // Meaningful only if parent !=
NULL
};
// Definition of all_nodes_sorted:
std::set<node_t *, node_sort_t> all_nodes_sorted;
// Definition of node_sort_t:
class node_sort_t
{
public:
bool operator()(const node_t *lhs, const node_t *rhs) const
{
return (lhs->state < rhs->state);
}
};