473,785 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Template member function help.

/*
I have never use template before, so bear with me.

Here is what I am trying to do:

I declare an abstract base class MatrixInterface with template to
define an interface for all my subsequent Matrix class. In
MatrixInterface class, I overloaded the << operator by calling a pure
virtual function PrintDebugMessa ge(ostream &os); then I can implement
the function on individual Matrix classes later.

I create a Matrix class called SimpleMatrix, and implemented
PrintDebugMessa ge(). Everthing works great until I want to implement
different behavior depending whether it's

template<typena me DataTypevoid
SimpleMatrix<Da taType>::PrintD ebugMessage(... ); //this is fine

or

//error
template<typena me DataTypevoid SimpleMatrix< SimpleMatrix<Da taType>
>::PrintDebugMe ssage(...);
I want to print out data differently if a instance of my SimpleMatrix
is a collection of sub-matrices of type SimpleMatrix. However, I can't
get that to work.

If I sepcialize the template parameter like:

// works, but now only when submatrices has type of SimpleMatrix<in t>
template<void SimpleMatrix< SimpleMatrix<in t>
>::PrintDebugMe ssage(...);
then it works. How I generalize the function above to handle
SimpleMatrice submatrix of all type?
Below is a sample code of my problem. It compiles on gcc 3.2.3 and
intel c++ 8.1
*/
/*************** *************** **************

*************** *************** **************/
#include <iostream>
#include <typeinfo>

using namespace std;

/*************** *************** ******
** ABC for all Matrix class
*************** *************** *******/
template<typena me DataType>
class MatrixInterface
{
public:
template<typena me T>
friend ostream & operator<<(ostr eam &os, MatrixInterface <Tconst &
matrix);
protected:
virtual void PrintDebugMessa ge(ostream &os) const= 0;

};

template<typena me DataType>
ostream & operator<<(ostr eam &os, MatrixInterface <DataTypecons t
&matrix)
{
matrix.PrintDeb ugMessage(os);
return os;
}
/*************** *************** ******
** Simple Matrix
*************** *************** *******/
template<typena me DataType>
class SimpleMatrix:pu blic MatrixInterface <DataType>
{
public:
SimpleMatrix();
SimpleMatrix(si ze_t nrow, size_t ncol);
virtual ~SimpleMatrix() ;
protected:

virtual void PrintDebugMessa ge(ostream &os) const;

size_t m_rowSize, m_colSize;
DataType *m_data;
};
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix()
:m_rowSize(0), m_colSize(0),
m_data(0)
{
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix(size_t nrow, size_t ncol)
:m_rowSize(nrow ), m_colSize(ncol) ,
m_data(0)
{
if(m_rowSize*m_ colSize>0) m_data =new
DataType[m_rowSize*m_col Size];
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::~Simpl eMatrix()
{
if(m_data != 0) delete [] m_data;
}
//
// Default PrintDebugMessa ge
//
template<typena me DataType>
void SimpleMatrix<Da taType>::PrintD ebugMessage(ost ream &os) const
{
size_t index;
cout << typeid(DataType ).name()<<"[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]";
}

/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* I want PrintDebugMessa ge to behave differently
* when I when the m_data submatrice of type = SimpleMatrix<Tw here T
* can be anything.
*
* Doesn't work :(
*
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/

/*
template<typena me T>
void SimpleMatrix< SimpleMatrix<T: :PrintDebugMess age(ostream &os)
const
{
size_t index;
cout << typeid(SimpleMa trix<int>).name ()<<"[[[[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]]]]";
}
*/
/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* This works. Don't really get it.
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/
template<>
void SimpleMatrix< SimpleMatrix<in t::PrintDebugMe ssage(ostream &os)
const
{
size_t index;
cout << "< "<<typeid(Simpl eMatrix<int>).n ame()<< " "<<"//** ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "**//";
}


/*************** ***
*************** ***/
int main(int argc, char **argv)
{
SimpleMatrix<in tIntMatrix(3,3) ;
SimpleMatrix<do ubleDoubleMatri x(2,2);
SimpleMatrix< SimpleMatrix<in t IntMatrixMatrix (2,2);
SimpleMatrix< SimpleMatrix<do uble DoubleMatrixMat rix(2,2);
cout<<IntMatrix <<endl;
cout<<DoubleMat rix<<endl;
cout<<IntMatrix Matrix<<endl;
cout<<DoubleMat rixMatrix<<endl ; //use wrong Print function
return 0;
}

Oct 17 '06 #1
4 1400

Jason wrote:
/*
I have never use template before, so bear with me.

Here is what I am trying to do:

I declare an abstract base class MatrixInterface with template to
define an interface for all my subsequent Matrix class. In
MatrixInterface class, I overloaded the << operator by calling a pure
virtual function PrintDebugMessa ge(ostream &os); then I can implement
the function on individual Matrix classes later.

I create a Matrix class called SimpleMatrix, and implemented
PrintDebugMessa ge(). Everthing works great until I want to implement
different behavior depending whether it's

template<typena me DataTypevoid
SimpleMatrix<Da taType>::PrintD ebugMessage(... ); //this is fine

or

//error
template<typena me DataTypevoid SimpleMatrix< SimpleMatrix<Da taType>
::PrintDebugMes sage(...);

I want to print out data differently if a instance of my SimpleMatrix
is a collection of sub-matrices of type SimpleMatrix. However, I can't
get that to work.

If I sepcialize the template parameter like:

// works, but now only when submatrices has type of SimpleMatrix<in t>
template<void SimpleMatrix< SimpleMatrix<in t>
::PrintDebugMes sage(...);

then it works. How I generalize the function above to handle
SimpleMatrice submatrix of all type?
Below is a sample code of my problem. It compiles on gcc 3.2.3 and
intel c++ 8.1
*/
/*************** *************** **************

*************** *************** **************/
#include <iostream>
#include <typeinfo>

using namespace std;

/*************** *************** ******
** ABC for all Matrix class
*************** *************** *******/
template<typena me DataType>
class MatrixInterface
{
public:
template<typena me T>
friend ostream & operator<<(ostr eam &os, MatrixInterface <Tconst &
matrix);
protected:
virtual void PrintDebugMessa ge(ostream &os) const= 0;

};

template<typena me DataType>
ostream & operator<<(ostr eam &os, MatrixInterface <DataTypecons t
&matrix)
{
matrix.PrintDeb ugMessage(os);
return os;
}
/*************** *************** ******
** Simple Matrix
*************** *************** *******/
template<typena me DataType>
class SimpleMatrix:pu blic MatrixInterface <DataType>
{
public:
SimpleMatrix();
SimpleMatrix(si ze_t nrow, size_t ncol);
virtual ~SimpleMatrix() ;
protected:

virtual void PrintDebugMessa ge(ostream &os) const;

size_t m_rowSize, m_colSize;
DataType *m_data;
};
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix()
:m_rowSize(0), m_colSize(0),
m_data(0)
{
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix(size_t nrow, size_t ncol)
:m_rowSize(nrow ), m_colSize(ncol) ,
m_data(0)
{
if(m_rowSize*m_ colSize>0) m_data =new
DataType[m_rowSize*m_col Size];
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::~Simpl eMatrix()
{
if(m_data != 0) delete [] m_data;
}
//
// Default PrintDebugMessa ge
//
template<typena me DataType>
void SimpleMatrix<Da taType>::PrintD ebugMessage(ost ream &os) const
{
size_t index;
cout << typeid(DataType ).name()<<"[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]";
}

/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* I want PrintDebugMessa ge to behave differently
* when I when the m_data submatrice of type = SimpleMatrix<Tw here T
* can be anything.
*
* Doesn't work :(
*
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/

/*
template<typena me T>
void SimpleMatrix< SimpleMatrix<T: :PrintDebugMess age(ostream &os)
const
{
size_t index;
cout << typeid(SimpleMa trix<int>).name ()<<"[[[[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]]]]";
}
*/
/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* This works. Don't really get it.
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/
template<>
void SimpleMatrix< SimpleMatrix<in t::PrintDebugMe ssage(ostream &os)
const
{
size_t index;
cout << "< "<<typeid(Simpl eMatrix<int>).n ame()<< " "<<"//** ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "**//";
}


/*************** ***
*************** ***/
int main(int argc, char **argv)
{
SimpleMatrix<in tIntMatrix(3,3) ;
SimpleMatrix<do ubleDoubleMatri x(2,2);
SimpleMatrix< SimpleMatrix<in t IntMatrixMatrix (2,2);
SimpleMatrix< SimpleMatrix<do uble DoubleMatrixMat rix(2,2);
cout<<IntMatrix <<endl;
cout<<DoubleMat rix<<endl;
cout<<IntMatrix Matrix<<endl;
cout<<DoubleMat rixMatrix<<endl ; //use wrong Print function
return 0;
}

Well, you first need to either explicity partially specialize the class
for that type(SimpleMati rx<Tand then use PrintDebugMessa ge the way
you have used it.

Remember the class is a template class. PrintDebugMessa fe is NOT a
member template.

Oct 17 '06 #2

Jason wrote:
/*
I have never use template before, so bear with me.

Here is what I am trying to do:

I declare an abstract base class MatrixInterface with template to
define an interface for all my subsequent Matrix class. In
MatrixInterface class, I overloaded the << operator by calling a pure
virtual function PrintDebugMessa ge(ostream &os); then I can implement
the function on individual Matrix classes later.

I create a Matrix class called SimpleMatrix, and implemented
PrintDebugMessa ge(). Everthing works great until I want to implement
different behavior depending whether it's

template<typena me DataTypevoid
SimpleMatrix<Da taType>::PrintD ebugMessage(... ); //this is fine

or

//error
template<typena me DataTypevoid SimpleMatrix< SimpleMatrix<Da taType>
::PrintDebugMes sage(...);

I want to print out data differently if a instance of my SimpleMatrix
is a collection of sub-matrices of type SimpleMatrix. However, I can't
get that to work.

If I sepcialize the template parameter like:

// works, but now only when submatrices has type of SimpleMatrix<in t>
template<void SimpleMatrix< SimpleMatrix<in t>
::PrintDebugMes sage(...);

then it works. How I generalize the function above to handle
SimpleMatrice submatrix of all type?
Below is a sample code of my problem. It compiles on gcc 3.2.3 and
intel c++ 8.1
*/
/*************** *************** **************

*************** *************** **************/
#include <iostream>
#include <typeinfo>

using namespace std;

/*************** *************** ******
** ABC for all Matrix class
*************** *************** *******/
template<typena me DataType>
class MatrixInterface
{
public:
template<typena me T>
friend ostream & operator<<(ostr eam &os, MatrixInterface <Tconst &
matrix);
protected:
virtual void PrintDebugMessa ge(ostream &os) const= 0;

};

template<typena me DataType>
ostream & operator<<(ostr eam &os, MatrixInterface <DataTypecons t
&matrix)
{
matrix.PrintDeb ugMessage(os);
return os;
}
/*************** *************** ******
** Simple Matrix
*************** *************** *******/
template<typena me DataType>
class SimpleMatrix:pu blic MatrixInterface <DataType>
{
public:
SimpleMatrix();
SimpleMatrix(si ze_t nrow, size_t ncol);
virtual ~SimpleMatrix() ;
protected:

virtual void PrintDebugMessa ge(ostream &os) const;

size_t m_rowSize, m_colSize;
DataType *m_data;
};
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix()
:m_rowSize(0), m_colSize(0),
m_data(0)
{
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::Simple Matrix(size_t nrow, size_t ncol)
:m_rowSize(nrow ), m_colSize(ncol) ,
m_data(0)
{
if(m_rowSize*m_ colSize>0) m_data =new
DataType[m_rowSize*m_col Size];
}
//
//
template<typena me DataType>
SimpleMatrix<Da taType>::~Simpl eMatrix()
{
if(m_data != 0) delete [] m_data;
}
//
// Default PrintDebugMessa ge
//
template<typena me DataType>
void SimpleMatrix<Da taType>::PrintD ebugMessage(ost ream &os) const
{
size_t index;
cout << typeid(DataType ).name()<<"[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]";
}

/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* I want PrintDebugMessa ge to behave differently
* when I when the m_data submatrice of type = SimpleMatrix<Tw here T
* can be anything.
*
* Doesn't work :(
*
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/

/*
template<typena me T>
void SimpleMatrix< SimpleMatrix<T: :PrintDebugMess age(ostream &os)
const
{
size_t index;
cout << typeid(SimpleMa trix<int>).name ()<<"[[[[ ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "]]]]";
}
*/
/*!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!
* This works. Don't really get it.
!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!*/
template<>
void SimpleMatrix< SimpleMatrix<in t::PrintDebugMe ssage(ostream &os)
const
{
size_t index;
cout << "< "<<typeid(Simpl eMatrix<int>).n ame()<< " "<<"//** ";
for(index = 0; index < m_rowSize*m_col Size; ++index)
cout<<m_data[index]<<" ";
cout << "**//";
}


/*************** ***
*************** ***/
int main(int argc, char **argv)
{
SimpleMatrix<in tIntMatrix(3,3) ;
SimpleMatrix<do ubleDoubleMatri x(2,2);
SimpleMatrix< SimpleMatrix<in t IntMatrixMatrix (2,2);
SimpleMatrix< SimpleMatrix<do uble DoubleMatrixMat rix(2,2);
cout<<IntMatrix <<endl;
cout<<DoubleMat rix<<endl;
cout<<IntMatrix Matrix<<endl;
cout<<DoubleMat rixMatrix<<endl ; //use wrong Print function
return 0;
}

Well, you first need to either explicity partially specialize the class
for that type(SimpleMati rx<Tand then use PrintDebugMessa ge the way
you have used it.

Remember the class is a template class. PrintDebugMessa ge is NOT a
member template.

Oct 17 '06 #3
Jason wrote:
/*
I have never use template before, so bear with me.

Here is what I am trying to do:

I declare an abstract base class MatrixInterface with template to
define an interface for all my subsequent Matrix class. In
MatrixInterface class, I overloaded the << operator by calling a pure
virtual function PrintDebugMessa ge(ostream &os); then I can implement
the function on individual Matrix classes later.

I create a Matrix class called SimpleMatrix, and implemented
PrintDebugMessa ge(). Everthing works great until I want to implement
different behavior depending whether it's

template<typena me DataTypevoid
SimpleMatrix<Da taType>::PrintD ebugMessage(... ); //this is fine

or

//error
template<typena me DataTypevoid SimpleMatrix< SimpleMatrix<Da taType>
>>>PrintDebugMe ssage(...);
[..]
What you're trying here is to specialise a member without specialising
the class first. That's prohibited, AFAIK.

Your solution lies either in specialising the entire class:

#include <iostream>
using namespace std;

template<class Tstruct Blah {
void out(ostream& os) {
os << "regular Blah\n";
}
};

template<class Tstruct Blah<Blah<T {
void out(ostream& os) {
os << "Blah of Blah\n";
}
};

int main()
{
Blah<intbi;
Blah<doublebd;
Blah<Blah<int bbi;
Blah<Blah<Blah< double bbbd;

bi.out(cout);
bd.out(cout);
bbi.out(cout);
bbbd.out(cout);
}

(which would require a whole lot of repetition) or in providing
a proxy "printer" class and specialising it instead (look up "policy
based design"):

#include <iostream>
using namespace std;

template<class Tstruct Blah;

template<class Tstruct Blah_Printer {
static void out(ostream& os, Blah<T>& blah);
};

template<class Tstruct Blah {
void out(ostream& os) {
Blah_Printer<T> ::out(os, *this);
}
};

template<class T>
void Blah_Printer<T> ::out(ostream& os, Blah<T>& b) {
os << "regular Blah\n";
}

// partial specialisation
template<class Tstruct Blah_Printer<Bl ah<T {
static void out(ostream& os, Blah<Blah<T& b) {
os << "Blah of Blah\n";
}
};

int main()
{
Blah<intbi;
Blah<doublebd;
Blah<Blah<int bbi;
Blah<Blah<Blah< double bbbd;

bi.out(cout);
bd.out(cout);
bbi.out(cout);
bbbd.out(cout);
}

Of course, 'Blah<Blah<Blah <Blah<Blah... >' is treated just like the
simply nested 'Blah<Blah<T' would be.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Oct 17 '06 #4


On Oct 17, 10:58 am, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
Jason wrote:
/*
I have never use template before, so bear with me.
Here is what I am trying to do:
I declare an abstract base class MatrixInterface with template to
define an interface for all my subsequent Matrix class. In
MatrixInterface class, I overloaded the << operator by calling a pure
virtual function PrintDebugMessa ge(ostream &os); then I can implement
the function on individual Matrix classes later.
I create a Matrix class called SimpleMatrix, and implemented
PrintDebugMessa ge(). Everthing works great until I want to implement
different behavior depending whether it's
template<typena me DataTypevoid
SimpleMatrix<Da taType>::PrintD ebugMessage(... ); //this is fine
or
//error
template<typena me DataTypevoid SimpleMatrix< SimpleMatrix<Da taType>
>>PrintDebugMes sage(...);
[..]What you're trying here is to specialise a member without specialising
the class first. That's prohibited, AFAIK.

Your solution lies either in specialising the entire class:

#include <iostream>
using namespace std;

template<class Tstruct Blah {
void out(ostream& os) {
os << "regular Blah\n";
}
};

template<class Tstruct Blah<Blah<T {
void out(ostream& os) {
os << "Blah of Blah\n";
}
};

int main()
{
Blah<intbi;
Blah<doublebd;
Blah<Blah<int bbi;
Blah<Blah<Blah< double bbbd;

bi.out(cout);
bd.out(cout);
bbi.out(cout);
bbbd.out(cout);
}

(which would require a whole lot of repetition) or in providing
a proxy "printer" class and specialising it instead (look up "policy
based design"):

#include <iostream>
using namespace std;

template<class Tstruct Blah;

template<class Tstruct Blah_Printer {
static void out(ostream& os, Blah<T>& blah);
};

template<class Tstruct Blah {
void out(ostream& os) {
Blah_Printer<T> ::out(os, *this);
}
};

template<class T>
void Blah_Printer<T> ::out(ostream& os, Blah<T>& b) {
os << "regular Blah\n";
}

// partial specialisation
template<class Tstruct Blah_Printer<Bl ah<T {
static void out(ostream& os, Blah<Blah<T& b) {
os << "Blah of Blah\n";
}
};

int main()
{
Blah<intbi;
Blah<doublebd;
Blah<Blah<int bbi;
Blah<Blah<Blah< double bbbd;

bi.out(cout);
bd.out(cout);
bbi.out(cout);
bbbd.out(cout);
}

Of course, 'Blah<Blah<Blah <Blah<Blah... >' is treated just like the
simply nested 'Blah<Blah<T' would be.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- Hide quoted text -- Show quoted text -


To Victor,

Thanks for the help! Your explanation clarify my confusion over
template.

Oct 17 '06 #5

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

Similar topics

2
6282
by: Elven | last post by:
Hi! I was trying to find the solution to this problem, but I don't think I could quite come up with the correct keywords to find it, since I'm pretty sure it's been asked before. In short, here's the situation (ignore missing namespaces, etc, since I'm not cut-pasting this..) // a.h template <class B>
2
2086
by: CoolPint | last post by:
As a self-exercise, I am trying to write a generic Priority Queue, which would store any type and and accept any user-definable "priority" function. After much tinkering, I came up with something like below: class PMinimum { public: template <typename T> bool operator()(const T & a, const T & b)
7
2133
by: Lionel B | last post by:
Greetings. The following code compiles ok and does what I'd expect it to do: ---------- START CODE ---------- // test.cpp
13
10685
by: john.constantine | last post by:
Hi I have this code: template<typename ClassType> struct S { template<typename FunctionType> void member() {}; };
2
2376
by: coolpint | last post by:
Can anyone kindly provide an explanation as to why the compiler does not "see" the function template in the contrieved code below? I think the argument deduction fails but can't figure out exactly what the problem is. Is it related to the fact that a nested class is involved? #include <iostream> using std::cout;
2
2319
by: pookiebearbottom | last post by:
Just trying to learn some things about templates. Was wondering how boost::tupple really works, but the headers were a bit confusing to me. I know you get do something like the following, just want to know how it works with the overloading of get<>(). boost::tupple<int,doubletup(1,2.0); double d=tup.get<2>(); // equal 2.0 // simple set up,
4
4067
by: James Aguilar | last post by:
Guys, When I specialize a template class member function (I.e. a member function of a template class) based on that class' type, bad things happen. Here's some code: ---- test_header.h #ifndef TEST_HEADER_H #define TEST_HEADER_H
12
1879
by: stefan.bruckner | last post by:
Hi, I am looking for a way to achieve the following. I've tried a couple of things, but they all ended up being too complicated: I have a templated class A. I want another class B to be able to call a method defined in A's base class which at runtime determines the template parameters (I know ahead what is allowed) and calls a templated member function B with A's template parameters.
5
2270
by: StephQ | last post by:
This is from a thread that I posted on another forum some days ago. I didn't get any response, so I'm proposing it in this ng in hope of better luck :) The standard explanation is that pointer to functions are hard to inline for the compiler, and so you won't be able to avoid function call overhead. This is an important aspect when you are calling a function very frequently for evaluation reason: think of the problem of performing...
16
3958
by: PengYu.UT | last post by:
Hi, I want to partial specialize the member function doit. But it doesn't work. Could you please help me to figure out what is wrong? Thanks, Peng template <typename T> class A {
0
10336
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.