Re: Cannot find source of undefined identifier
From: Alf P. Steinbach (alfps_at_start.no)
Date: 03/30/04
- Next message: Julie: "Re: Placement of {"
- Previous message: Macro Maniac: "Challenging macro with default value"
- In reply to: Dave: "Cannot find source of undefined identifier"
- Next in thread: Dave: "Re: Cannot find source of undefined identifier"
- Reply: Dave: "Re: Cannot find source of undefined identifier"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Mar 2004 19:17:28 GMT
* "Dave" <better_cs_now@yahoo.com> schriebt:
> Below, I have included a greatly-stripped-down but complete example of a
> problem I am having. Specifically, my call to is_goal() (in the while loop)
> results in an "identifier is undefined" error. Can anybody out there see
> what the problem is? I'm stumped...
>
> Thanks,
> Dave
>
> #include <set>
> #include <vector>
>
> using namespace std;
>
> template <
> typename STATE_T,
> typename OP_T,
> typename GOAL_TEST_T
> >
> class search_engine_t: public GOAL_TEST_T
> {
> public:
> vector<OP_T> depth_limited(
> const STATE_T &initial_state,
> int limit
> )
> {
> STATE_T current_state(initial_state);
> vector<OP_T> rval;
>
> while (!is_goal(current_state))
> {
> }
>
> return rval;
> }
> };
>
> typedef int state_t;
> typedef int op_t;
>
> class goal_test_t
> {
> public:
> bool is_goal(const state_t &state)
> {
> return true;
> }
> };
>
> int main()
> {
> search_engine_t<
> state_t,
> op_t,
> goal_test_t
> > se;
>
> se.depth_limited(5, 5);
> }
It compiles fine with VC 7.1 but not with Comeau online.
With Comeau online I had to add a "using GOAL_TEST_T::is_goal;" in
there.
Don't know why that should be required or even why it works.
-- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
- Next message: Julie: "Re: Placement of {"
- Previous message: Macro Maniac: "Challenging macro with default value"
- In reply to: Dave: "Cannot find source of undefined identifier"
- Next in thread: Dave: "Re: Cannot find source of undefined identifier"
- Reply: Dave: "Re: Cannot find source of undefined identifier"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|