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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:10:25+00:00 2026-06-13T05:10:25+00:00

I am trying to use templates along with vector in my code the following

  • 0

I am trying to use templates along with vector in my code the following way:

In my header file:

template <typename V>
void changeConfig(char option, vector <V> & arg_in){
        // ....
  }

In the source file:

vector <int> p = {4};
changeConfig('w' ,p);

And this’s the error that I get:

/include/config.h: In member function ‘void Cfconfig::changeConfig(char, std::vector<_RealType>&) [with V = int]’:

src/config_test.cpp:10:38: instantiated from here

/include/config.h:68:25: error: no match for call to ‘(int_vector {aka std::vector}) (std::vector&)’

make: *** [featureconfig_test.o_dbg] Error 1

I tried the suggestions on this thread but none of them seem to work.

C++ Templates Error: no matching function for call

Any help would be appreciated. Thanks.

Okay, I made a short snippet of my code which gives the same error:

#include <iostream>
#include <stdio.h>
#include <stdarg.h>
#include <cstdio>
#include <opencv2/opencv.hpp>
#include <string.h>
#include <math.h>
#include <complex.h>
#include <dirent.h>
#include <fstream>
#include <typeinfo> 
#include <unistd.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#include <initializer_list>
#include <vector>
#include <algorithm>


using namespace std;


template <typename V>
void changeConfig(char option, vector <V> & arg_in){

     vector<int> window = {5};
     vector<double> scale = {3};

            switch(option){
                    case 'w':                                        
                            window(arg_in);
                            break;
                    case 's':
                            scale(arg_in);
                            break;
            } 

    }


int main(){

    vector <int> p = {3};
    changeConfig<int>('w', p);

    return 0;

}

I compiled using :
g++ -std=c++0x test_template.cpp -o test

which gave me this error:

test_template.cpp: In function ‘void changeConfig(char, std::vector<_RealType>&) [with V = int]’:

test_template.cpp:45:33: instantiated from here

test_template.cpp:32:33: error: no match for call to ‘(std::vector) (std::vector&)’

test_template.cpp:35:33: error: no match for call to ‘(std::vector) (std::vector&)’

  • 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-13T05:10:27+00:00Added an answer on June 13, 2026 at 5:10 am

    The problem is with window(arg_in); and scale(arg_in);. You are trying to call an std::vector like a function with another std::vector as an argument. I think you are trying to assign one vector to another, so just use assignment or swap.

     vector<int> window = {5};
     vector<int> scale = {3}; // Note I changed this from double to int
    
            switch(option){
                    case 'w':                                        
                            window = arg_in; // Perhaps you meant arg_in = window
                            break;
                    case 's':
                            scale = arg_in;  // Perhaps you meant arg_in = scale
                            break;
            } 
    
    }
    

    If you want to use vector<double> scale, use scale.assign(arg_in.begin(), arg_in.end()); instead or the other way around arg_in.assign(scale.begin(), scale.end());.

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

Sidebar

Related Questions

I'm trying to use PDO in this way and reuse the output template: selected_products_show
I am trying to use KO templates to parse a JSON file ( see
im trying to use templates for my backbone views. I tried it with underscore.template
I'm trying to use stl algorithm for_each without proliferating templates throughout my code. std::for_each
I'm trying to use templates to get std:list of items, where each item has
I'm trying to use the T4 templates in my MVC project. This screencast suggests
I am trying to accomplish a module where i need to use nested templates
As documented here: http://www.jblotus.com/2011/05/24/keeping-your-handlebars-js-templates-organized/ I am trying to use this function: ( function getTemplateAjax(path,
I'm going a little nuts trying to figure out how to use template inheritance
I'm trying to use coffeekup as my default template app.set 'view engine', 'coffee' app.register

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.