Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6784685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:01:39+00:00 2026-05-26T17:01:39+00:00

I have the following in a 3rd party core header, which i would prefer

  • 0

I have the following in a 3rd party core header, which i would prefer not to touch:

template<typename Iterator_T>
struct Tree
{
    template<typename Node_T>
    struct TypedNode;

    struct AbstractNode
    {
        AbstractNode(Iterator_T t)
        {
            ...
        }

        template<typename Rule_T>
        TypedNode<Rule_T>* NewChild()
        {
            TypedNode<Rule_T>* ret = new TypedNode<Rule_T>(this);
            AddChild(ret);
            return ret;
        }

        template<typename T>
        TypedNode<T>* GetFirstTypedChild();
    };

    template<typename Node_T>
    struct TypedNode : AbstractNode
    {
        ...
    };

    template<typename Rule_T, typename ParserState_T>
    void CreateNode(ParserState_T& p)
    {
        current = current->template NewChild<Rule_T>();
    }
};

template<typename Node_T>
struct TreeBuilder
{
    Tree<Iterator_T> tree;

    template<typename Rule_T>
    void CreateNode()
    {
        tree.CreateNode<Rule_T>(*this);
    }
};

and would like to add a subclass of TypedNode to the tree with additional methods and members. Is there a clean way to do this without refactoring the original code? I think the crux of the issue is:
TypedNode* ret = new TypedNode(this);

This looks like it could use a Factory, perhaps by specializing the TypedNode template instantiation and including the header before the base headers. Something like:

template<>
struct Tree<const char*>::TypedNode<SpecificRuleType>
{
    ...
};

But it fails complaining “too few template-parameter-lists”. Probably something trivial but my <template-fu> is a bit rusty :>(. Any ideas would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:01:39+00:00Added an answer on May 26, 2026 at 5:01 pm

    Both Tree and TypedNode are templates, your specialization should be:

    template<> // for Tree<...>
    template<> // for TypedNode<...>
    struct Tree<const char*>::TypedNode<SpecificRuleType>
    {
        ...
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a 3rd party struct that is comprised of the following: [StructLayout(LayoutKind.Sequential, Size=1)]
I have the following XML, which is generated by a 3rd-party library: <PhoneNumbers> <PhoneNumber
I have a following problem: There is a 3rd party extension which automatically adds
We have a 3rd party web application which works on in IE6, but not
I have a 3rd party component which requires me to give it the bitsperpixel
I Have a 3rd Party component ArchestrA.MxAccess.dll (which is build on x86 by corgflags)
I have a Unicode Win32 application that uses 3rd party libraries, some of which
I have an application, which uses some 3rd party libraries, for example Tesseract library.
I currently have a web based application which strictly relies on a 3rd party
So I have the following code - written by a 3rd party supplier. Can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.