Problem with custom tree node factory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with custom tree node factory

Sebastian Alff
Hi!

I'm trying to create a custom tree node factory:
-----------------------------------
template <typename ValueT>
class MyTreeFact
{
public:
     // This inner class is so that node_val_data_factory can simluate
     // a template template parameter
     template <typename IteratorT>
     class factory
     {
     public:
         std::vector<IteratorT>::iterator It; // <--- Error!

         typedef blubb<IteratorT, ValueT> node_t;

         static node_t create_node(IteratorT const& first, IteratorT const&  
last,
                 bool is_leaf_node){return node_t();}

         static node_t empty_node(){return node_t();}

         template <typename ContainerT>
         static node_t group_nodes(ContainerT const& nodes){return  
node_t();}
     };
};
-----------------------------------

With this code g++ gives me the error "expected ';' before It" for the  
commented line.
This is how I call the parse function:
        "pt_parse<CppTreeFactory<int> >(FirstIt, LastIt, +anychar_p, space_p);"

Does anyone know why this happens and how I can solve this problem?

regards
        -Sebastian


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Problem with custom tree node factory

Carl Barron

On Sep 27, 2005, at 8:00 AM, Sebastian Alff wrote:

> Hi!
>
> I'm trying to create a custom tree node factory:
> -----------------------------------
> template <typename ValueT>
> class MyTreeFact
> {
> public:
>     // This inner class is so that node_val_data_factory can simluate
>     // a template template parameter
>     template <typename IteratorT>
>     class factory
>     {
>     public:
>         std::vector<IteratorT>::iterator It; // <--- Error!
>
>         typedef blubb<IteratorT, ValueT> node_t;
>
>         static node_t create_node(IteratorT const& first, IteratorT
> const& last,
>                 bool is_leaf_node){return node_t();}
>
>         static node_t empty_node(){return node_t();}
>
>         template <typename ContainerT>
>         static node_t group_nodes(ContainerT const& nodes){return
> node_t();}
>     };
> };
> -----------------------------------
>
> With this code g++ gives me the error "expected ';' before It" for the
> commented line.
> This is how I call the parse function:
> "pt_parse<CppTreeFactory<int> >(FirstIt, LastIt, +anychar_p,
> space_p);"
>
> Does anyone know why this happens and how I can solve this problem?
>
> regards
> -Sebastian
>
>
    try
    typename std::vector<IteratorT>::iterator It;

   without typename it parses as   expresssion expression and that is
why it is expecting a ';'
before It.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general
Reply | Threaded
Open this post in threaded view
|

Re: Problem with custom tree node factory

Sebastian Alff
Yes, that was my mistake... Thanks a lot!

regards
        -Sebastian

Am Thu, 29 Sep 2005 23:29:39 -0400 schrieb Carl Barron  
<[hidden email]>:

>
> On Sep 27, 2005, at 8:00 AM, Sebastian Alff wrote:
>
>> Hi!
>>
>> I'm trying to create a custom tree node factory:
>> -----------------------------------
>> template <typename ValueT>
>> class MyTreeFact
>> {
>> public:
>>     // This inner class is so that node_val_data_factory can simluate
>>     // a template template parameter
>>     template <typename IteratorT>
>>     class factory
>>     {
>>     public:
>>         std::vector<IteratorT>::iterator It; // <--- Error!
>>
>>         typedef blubb<IteratorT, ValueT> node_t;
>>
>>         static node_t create_node(IteratorT const& first, IteratorT  
>> const& last,
>>                 bool is_leaf_node){return node_t();}
>>
>>         static node_t empty_node(){return node_t();}
>>
>>         template <typename ContainerT>
>>         static node_t group_nodes(ContainerT const& nodes){return  
>> node_t();}
>>     };
>> };
>> -----------------------------------
>>
>> With this code g++ gives me the error "expected ';' before It" for the  
>> commented line.
>> This is how I call the parse function:
>> "pt_parse<CppTreeFactory<int> >(FirstIt, LastIt, +anychar_p, space_p);"
>>
>> Does anyone know why this happens and how I can solve this problem?
>>
>> regards
>> -Sebastian
>>
>>
>     try
>     typename std::vector<IteratorT>::iterator It;
>
>    without typename it parses as   expresssion expression and that is  
> why it is expecting a ';'
> before It.
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Spirit-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/spirit-general
>




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Spirit-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/spirit-general