473,396 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to code this?

ccs
How to make a member function of a class take a type of std::bitset<N>, and
N is a variable that will be determined at run time? Thanks in advance!
Jul 22 '05 #1
4 1025

"ccs" <cc*@stopspamming.com> wrote in message
news:_K*******************@bgtnsc04-news.ops.worldnet.att.net...
How to make a member function of a class take a type of std::bitset<N>, and N is a variable that will be determined at run time? Thanks in advance!


You cannot, template arguments must be determined at compile time.

Use vector<bool> instead of bitset<N>.

john
Jul 22 '05 #2

"ccs" <cc*@stopspamming.com> wrote in message
news:_K*******************@bgtnsc04-news.ops.worldnet.att.net...
How to make a member function of a class take a type of std::bitset<N>, and
N is a variable that will be determined at run time? Thanks in advance!


Take a look at boost::Dynamic Bitset library.
Jul 22 '05 #3
ccs
Sharad Kala <no*****************@yahoo.com> wrote in message
news:2j************@uni-berlin.de...

"ccs" <cc*@stopspamming.com> wrote in message
news:_K*******************@bgtnsc04-news.ops.worldnet.att.net...
How to make a member function of a class take a type of std::bitset<N>, and N is a variable that will be determined at run time? Thanks in advance!


Take a look at boost::Dynamic Bitset library.

Thanks for the tip!

How can a type of "vector<double>" or "valarray<double>" of dynamic size be
passed in a function as either reference or pointer?
Jul 22 '05 #4

"ccs" <cc*@stopspamming.com> wrote in message
news:CE*******************@bgtnsc04-news.ops.worldnet.att.net...
Sharad Kala <no*****************@yahoo.com> wrote in message
news:2j************@uni-berlin.de...

"ccs" <cc*@stopspamming.com> wrote in message
news:_K*******************@bgtnsc04-news.ops.worldnet.att.net...
How to make a member function of a class take a type of std::bitset<N>, and N is a variable that will be determined at run time? Thanks in advance!


Take a look at boost::Dynamic Bitset library.

Thanks for the tip!

How can a type of "vector<double>" or "valarray<double>" of dynamic size be
passed in a function as either reference or pointer?


Something like -
#include <iostream>
#include <vector>

void foo(std::vector<int>& v)
{
v.push_back(7);
v.push_back(8);
}

int main()
{
std::vector<int> vec;
vec.push_back(5);
foo(vec);
std::vector<int>::const_iterator itr;
for (itr = vec.begin(); itr != vec.end(); ++ itr)
std::cout << *itr; // print 578
}

-Sharad
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Harold Crump | last post by:
Greetings, I have a PHP/MySQL application that I am deploying at a client's. I am fairly certain that they will steal my source code and re-sell to other companies. I would like to somehow...
0
by: Rasmus Fogh | last post by:
Dear All, I need a way of writing strings or arbitrary Python code that will a) allow the strings to be read again unchanged (like repr) b) write multiline strings as multiline strings instead...
0
by: Rasmus Fogh | last post by:
Someone raised the question of automatic code generation a few weeks back. And yes, we (CCPN) are using automatic Python code generation in a major way. Basically we are making data models in...
8
by: Irmen de Jong | last post by:
What would be the best way, if any, to obtain the bytecode for a given loaded module? I can get the source: import inspect import os src = inspect.getsource(os) but there is no...
5
by: Sky Fly | last post by:
Hi, I know that when an .NET exe is run, the CLR loads the exe (along with dependent assemblies), compiles them to native code then runs the code. Assuming the assemblies are loaded from a...
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
3
by: DPfan | last post by:
What's exactly the meaning of "code reuse" in C++? Why such kind of reuse have more advantages over the counterpart in other language like in C? How is "code reuse" realized in C++? By...
1
by: geek04 | last post by:
i'm using pro*c to precompile my c++ code which accesses oracle 9i database, i'm running a oracle 9i client on my system on compiling the c++ file (generated by pro*c)i'm getting following...
5
by: ED | last post by:
I currently have vba code that ranks employees based on their average job time ordered by their region, zone, and job code. I currently have vba code that will cycle through a query and ranks each...
6
by: Fuzzyman | last post by:
Hello all, I'm trying to extract the code object from a function, and exec it without explicitly passing parameters. The code object 'knows' it expects to receive paramaters. It's 'arg_count'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.