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

  • Home
  • SEARCH
  • 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 3842658
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:49:31+00:00 2026-05-19T15:49:31+00:00

Suppose I am writing a template library consisting of a function template template<T> void

  • 0

Suppose I am writing a template library consisting of a function template

template<T> void f(T);

with the requirement that it works with a predefined set of classes A, B, C, and D, e.g., the following must compile:

template<> void f(A);
template<> void f(B);
template<> void f(C);
template<> void f(D);

Which test framework can I use to write test cases that captures this requirement at runtime instead of failing at compilation of the test code? In another word, I would like the framework to instantiate the templates at runtime and produce a nicely formatted error report if a subset of them fails.

I know I can forego test frameworks altogether and simply write a simple cc file containing the 4 lines above. But I was hoping I could incorporate this requirement into regular, standard test cases for generation of test status reports. For example,

test f works with A: passed.
test f works with B: passed.
test f works with C: failed!  Cannot cast type C!
test f works with D: passed.

3 of 4 tests passed.
1 of 4 tests failed.
  • 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-19T15:49:32+00:00Added an answer on May 19, 2026 at 3:49 pm

    Write a test case that spawns the compiler… that’s how e.g. autoconf tests for existence of features.

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

Sidebar

Related Questions

Suppose I'm writing a library or a set of tools mytool where a class
I'm writing wrapper for java library. Suppose ClassA and ClassB (in default package). In
Suppose I am writing an application in C++ and C#. I want to write
I'm writing an app that supposed to copy a bunch of files from one
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new
Suppose I have the following CSS rule in my page: body { font-family: Calibri,
I'm currently writing DataTemplate for my custom type lets say FootballPlayer. In this template
I'm trying to write a custom inclusion_tag in django. Following the example on http://docs.djangoproject.com/en/dev/howto/custom-template-tags/
I am writing a tool that needs to access all the revisions of a
Suppose you were writing a network-based WinForms application which is supposed to run in

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.