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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:57:55+00:00 2026-05-26T19:57:55+00:00

I am trying to implement a template template <class object_t, long size, object_t nullObject>

  • 0

I am trying to implement a template

template <class object_t, long size, object_t nullObject>
class lf_deque
{
  // ...
}

when I try to instantiate this template with an int, it compiles fine, but if I try to instantiate with a pointer i get the error:

could not convert template argument '0' to 'int*'

lf_deque<int,  10, 0> intDeque; // WORKS
lf_deque<int*, 10, 0> ptrDeque; // ERROR

any thoughts or ideas why i would get this inconsistency?

  • 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-26T19:57:56+00:00Added an answer on May 26, 2026 at 7:57 pm

    In templates when a function/class is resolved with ADL(Argument Dependent Lookup) Function Template Argument Deduction, there is no implicit conversion. Only exactly matching paramters can resolve to instantiate a appropriate template function/class. That is the root cause of the error.

    The compiler tells you that it cannot implicitly convert last parameter 0 to int *, Since when you pass first argument as int *, object_t is int * and the compiler expects an int * as the third argument as well. It tells you that 0 is an invalid type as the third argument for the class template.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a template class that would be able to tell
I'm trying to implement the following in C++: template <class T> class Inner {
I'm trying to implement is_base template and I have a little problem. Why this
I am trying to implement a dynamic array: template <typename Item> class Array {
I've been trying to implement a function that needs partial template specializations and fallen
I'm doing this project to manage a bank and I'm trying to implement code
I am trying to implement a List class using pointers and am trying to
I am trying to implement a leftist tree using heaps as a base class.
I am trying to implement a template function with handles void differently using template
Okay, I'm trying to implement a templated class of an array-based queue called Queue.

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.