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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:24:17+00:00 2026-05-26T11:24:17+00:00

I have a processing pipeline implemented, but I would like to improve it like

  • 0

I have a processing pipeline implemented, but I would like to improve it like this :

#include <iostream>

// buffers
struct src{}; struct b1{}; struct snk{};
// filters
struct f1
{
    f1( const src &, b1 & ) { std::cout << "f1( src, b1 )" << std::endl; }
};
struct f2
{
    f2( const b1 &, snk & ) { std::cout << "f2( b1, snk )" << std::endl; }
};
// the pipeline
template< typename... Filters >
struct pipeline
{
    template< typename LastB >
    pipeline( const LastB & )
    {}
};
template < typename T1, typename... T >
struct pipeline< T1, T... > : pipeline< T... >
{
    template< typename... Buffs, typename Bin, typename Bout >
    pipeline( Buffs &... buffs, Bin & bin, Bout & bout ) :
        pipeline< T... >( buffs..., bin ),
        filter( bin, bout )
    {
    }

    T1 filter;
};

int main()
{
    src ba; b1  bb; snk bc;

    pipeline< f1 > p1( ba, bb );
    pipeline< f1, f2 > p2( ba, bb, bc ); // the problem is in this line!
}

Unfortunately, the example above produces next errors :

sda_variadic.cpp: In function 'int main()':
sda_variadic.cpp:40:39: error: no matching function for call to 'pipeline<f1, f2>::pipeline(src&, b1&, snk&)'
sda_variadic.cpp:40:39: note: candidates are:
sda_variadic.cpp:26:5: note: template<class ... Buffs, class Bin, class Bout> pipeline<T1, T ...>::pipeline(Buffs& ..., Bin&, Bout&)
sda_variadic.cpp:23:8: note: constexpr pipeline<f1, f2>::pipeline(const pipeline<f1, f2>&)
sda_variadic.cpp:23:8: note:   candidate expects 1 argument, 3 provided
sda_variadic.cpp:23:8: note: constexpr pipeline<f1, f2>::pipeline(pipeline<f1, f2>&&)
sda_variadic.cpp:23:8: note:   candidate expects 1 argument, 3 provided

What is the reason for this error?
How to fix it?

Just a small explanation. I expect that the example above will first create an object of the unspecialized pipeline<>( snk ), then the specialized object pipeline< f1 >(b1,snk), and then the specialized object pipeline< f1, f2 >(src,b1,snk).
btw take a note that the above example works for 1 filter (pipeline< f1).

  • 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-26T11:24:17+00:00Added an answer on May 26, 2026 at 11:24 am
    template< typename... Buffs, typename Bin, typename Bout >
    pipeline( Buffs &... buffs, Bin & bin, Bout & bout ) :
        pipeline< T... >( buffs..., bin ),
        filter( bin, bout )
    {
    }
    

    Since the function parameter pack (Buffs) is not in the last position, it cannot be deduced. From 14.8.2.1 Deducing template arguments from a function call [temp.deduct.call] paragraph 1:

    1. […] For a function parameter pack that does not occur at the end of the parameter-declaration-list, the type of the parameter pack is a non-deduced context. […]

    Since you can’t explicitly pass template parameters to a constructor, it can’t be called at all (not that it matters for your problem though).

    I’d recommend using std::tuple to manipulate the variadic arguments, such that you call the constructor like so: pipeline(std::forward_as_tuple(b0, b1, b2), in, out) and an empty tuple would be passed to the last stage.

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

Sidebar

Related Questions

My Goal I would like to have a main processing thread (non GUI), and
I have a pseudo-realtime data processing application where I would like to use LazyInit<double>
I have a text input : <input type=text onkeydown=processText(this) /> I have a processing
I have a processing file for my website's payments. It works just fine, but
I have a processing based Java application that runs fine in Eclipse but the
Is there anyone who have encountered Processing Dirty Regions error in MyEclipse? Actually everytime
In a legacy project that I'm on, we have several processing that are preformed
I have no problems processing jQuery GET requests in a controller, however I cannot
I have an application processing network communication with blocking calls. Each thread manages a
To make a long story short I have to use processing in a class

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.