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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:07:18+00:00 2026-05-27T15:07:18+00:00

This program is designed to make a library to make it easy for C++

  • 0

This program is designed to make a library to make it easy for C++ programmers to simulate circuits. Any feedback is appreciated. The error that I’m faced with puzzles me to no end.

wire.h file

template<typename S>
class wire
{
  public:
    // default constructor
    wire() : _s() {}

    // constructor with one parameter of type S
    wire(S s) : _s(&s) {}

    // converter to signal
    operator S() const { return *_s; }

    // resets the signal of the wire and return the signal
    S operator()(S s) { *_s = s; return s; }

  private:
    // pointer to signal being carried
    S *_s;
};

// functor, returns the negation of the negation of the signal of the wire as a wire
template<typename W>
struct ww_not
{
  W operator()(W w1) const { return ~w1; };
};

main.cpp

#include <iostream>
#include <boost/function.hpp>
#include "wire.h"
typedef unsigned sig_type;
typedef wire<sig_type> wire_type;

main()
{
  sig_type s1(0x2), s2(0x3), s3(0x5), s4(0x7), s5(0xb), s6(0xc), s7(0x11);
  wire_type w1(s1), w2(s2), w3(s3), w4(s4), w5(s5), w6(s6), w7(s7);

  boost::function<wire_type (wire_type)> _not;
  //_not = &ww_not;
  // error missing template type
  _not = &ww_not<wire_type>;
  // error: expected primary-expression before ';' token
}

I’ve tried it several different ways, and it should work.

  • 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-27T15:07:18+00:00Added an answer on May 27, 2026 at 3:07 pm

    ww_not is a functor class which needs to be instantiated, not a function with an address:

    _not = ww_not<wire_type>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's this program, pdftotext, that can convert a pdf file to a text file.
I've designed a simple program that has a counter class and inside that counter
Working through several layers of an MVC architecture designed program, I find that I
I have a program in Python with PyQt, designed to run on Windows. This
I created a program in Java and I designed it so that methods that
This program I use has it's own variables to set when you run it,
This program stores pairs in a map, counting the number of times a word
This program reads emails (really just a .txt file structured like an email) and
This program I'm doing is about a social network, which means there are users
This program is meant to generate a dynamic array, however it gives an access

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.