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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:07:07+00:00 2026-05-16T12:07:07+00:00

I am trying to build a template function. Inside templated classes are used and

  • 0

I am trying to build a template function. Inside templated classes are used and I would like to pass the template type of the function to those classes. So I have:

template <class T>
T find_bottleneck (ListGraph &g, CrossRefMap<ListGraph, Edge, T> &weight, Node &s, Node &t) {
    // Check if theres a single edge left
    if (countEdges(g) == 1) {
        CrossRefMap<ListGraph, Edge, T>::ValueIt itr = weight.beginValue();
        return *itr;
    }

However this fails, citing

lemon_graph.cpp: In function ‘T find_bottleneck(lemon::ListGraph&, lemon::CrossRefMap<lemon::ListGraph, lemon::ListGraphBase::Edge, T>&, Node&, Node&)’:
lemon_graph.cpp:20: error: expected ‘;’ before ‘itr’
lemon_graph.cpp:21: error: ‘itr’ was not declared in this scope

I tried to recreate this using a simple example of a function which generates vectors based on the type passed to it and that compiled fine, so I am not sure what the problem is here.

  • 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-16T12:07:07+00:00Added an answer on May 16, 2026 at 12:07 pm

    It’s just a missing typename.

    typename CrossRefMap<ListGraph, Edge, T>::ValueIt
    

    typename is the answer to at least 50% of all C++-template-related questions 🙂 It tells the compiler that what follows is always a type, regardless of the template parameters (ValueIt could for example be a int instead of a typedef for an iterator).

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've been digging a bit on this, and it would… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer Different OS's? Yes. Operating Systems are the go-between between the… May 17, 2026 at 1:37 am
  • Editorial Team
    Editorial Team added an answer So the answer is for the time being : Nope,… May 17, 2026 at 1:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm trying to create a generic build template for my Makefiles, kind of like
I'm trying to use the type(,,) function to dynamically build a module. The module
I have a std::vector< tr1::shared_ptr<mapObject> > that I'm trying build from data contained in
I'm trying to build a simple User Template system so that my users can
[SOLVED] I copy the chipmunk folder structure from cocos2d+chipmunk template and build OK. Classes/Chipmunk/include/src
I'm trying to build the following block of code in a 1-file .cpp file:
I am trying to build/run an old C++ system. I've already been able to
Ok... I have this struct and comparison function- struct Edge { char point1; char
Trying to build a legacy code in VS2005 and get errors in VC header
I'm trying to build a streaming .mp3 player to run various sound files on

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.