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 7939607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:09:13+00:00 2026-06-03T23:09:13+00:00

I have a class like this: struct WorkItemResultData; template <typename ExecutionPolicy> class Engine {

  • 0

I have a class like this:

struct WorkItemResultData;

template <typename ExecutionPolicy>
class Engine
{
public:
    typedef std::shared_ptr<WorkItemResultData> WorkItemResultData_ptr;
}

typedef does not depend on any template argument. Is there a way to use type Engine::WorkItemResultData_ptr outside of Engine class ?

EDIT I know I could use it like awoodland proposed the solution bellow but my typedef is independent of type arguments and want to be able to do it without specifying a specific Engine type.

  • 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-06-03T23:09:15+00:00Added an answer on June 3, 2026 at 11:09 pm

    Is there a way to use type Engine::WorkItemResultData_ptr outside of Engine class ?

    Yes, but you’ll need to say typename if it’s in a template context, e.g.:

    template <typename T>
    void foo() {
      typename Engine<T>::WorkItemResultData_ptr instance;
    }
    

    You can’t access that typedef without a type. There are three workarounds possible though:

    1. typedef outside the template! – it’s likely it doesn’t have much to do with the template if it doesn’t depend on the types.
    2. Use a bodge and refer to Engine<void>::WorkItemResultData_ptr.
    3. Have a non-template base class which contains the typedef and inherit from that. You can access the non-template base class fine then.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class template <typename T> struct Trait { typedef std::false_type IsGood; };
I have a class like this: class MyClass{ public: MyClass(int Mode); private: std::map <
I have a C++ class like this: class ConnectionBase { public: ConnectionBase(); template <class
I have a class like this: template <class T> class bag { private: typedef
I have a class defined like this: public class StateMachineMetadata<T> where T: struct {
I have a model class like this: namespace Models { public struct Localization {
Suppose I have something like this: struct EmptyClass{}; template<typename T1, typename T2 = EmptyClass,
i have a generic linked list struct like this template <typename E, typename F>
I have a class like this public class foo { private void getThread() {
I have a class like this: public class Contest { List<ContestTeam> Teams { get;

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.