473,763 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Resolving template parameters

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.

I'm imagining something like this - I know that it can't work like
this, but I would like to achieve a similarly simple syntax:

class Base
{
public:
virtual void call(...) = 0;
}

template <class T1,class T2>
class A : public Base
{
public:
void call(...)
{
if (typeid(T1) == ...)
...
else if (...)
...
else if (...)
...
}
}
class B
{
public:

void x()
{
Base *pSomePtr = ...;
pSomePtr->call(this,&B:: y);
};

template <class T1,class T2>
void y()
{
// do stuff
};
};

Any help on how I could realize this would be greatly appreciated .

Thanks,
Stefan

Feb 21 '07 #1
12 1877
st************* @gmail.com wrote:
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.

I'm imagining something like this - I know that it can't work like
this, but I would like to achieve a similarly simple syntax:

class Base
{
public:
virtual void call(...) = 0;
}

template <class T1,class T2>
class A : public Base
{
public:
void call(...)
{
if (typeid(T1) == ...)
...
else if (...)
...
else if (...)
...
}
}
class B
{
public:

void x()
{
Base *pSomePtr = ...;
pSomePtr->call(this,&B:: y);
};

template <class T1,class T2>
void y()
{
// do stuff
};
};

Any help on how I could realize this would be greatly appreciated .

Thanks,
Stefan
This works for me, and it isn't retricted to a known set of template
parameters. But it doesn't pass the member function to be called to the
call method. I wasn't sure if that was part of your requirements or not.

john
#include <iostream>

class B;

class Base
{
public:
virtual void call(B* b) = 0;
};

class B
{
public:

void x(Base *pSomePtr)
{
pSomePtr->call(this);
};

template <class T1,class T2>
void y()
{
std::cout << typeid(T1).name () << ' ' << typeid(T2).name () << '\n';
};
};

template <class T1, class T2>
class A : public Base
{
public:
void call(B* b)
{
b->y<T1, T2>();
}
};

int main()
{
A<int, doublea;
B b;
b.x(&a);
}
Feb 21 '07 #2
John Harrison wrote:
>
This works for me, and it isn't retricted to a known set of template
parameters. But it doesn't pass the member function to be called to the
call method. I wasn't sure if that was part of your requirements or not.

john
#include <iostream>

class B;

class Base
{
public:
virtual void call(B* b) = 0;
};

class B
{
public:

void x(Base *pSomePtr)
{
pSomePtr->call(this);
};

template <class T1,class T2>
void y()
{
std::cout << typeid(T1).name () << ' ' << typeid(T2).name () << '\n';
};
};

template <class T1, class T2>
class A : public Base
{
public:
void call(B* b)
{
b->y<T1, T2>();
}
};

int main()
{
A<int, doublea;
B b;
b.x(&a);
}
Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).
--------------------------------------------------------------
// Modifying your example and removing ellipsis since
// it is too vague for me to work with. WLOG,
// assuming all your functions are have void arguments.

// forward declaration required.
class B;

// Good Stuff here. Keep
class Base
{
public:
// I am deducing you want this to apply a member function to
// an instance of class B
virtual void call( B *b ) =0;
}

// had to move the definition of B up due to dependency.
class B
{
public:

void x();

template <class T1,class T2>
void y()
{
T1 *a = new T1();
T2 *b = new T2();
// leak memory!! WooHoo!
};
};

template <class T1,class T2>
class A : public Base
{
public:
// this needs to be virtual right?
virtual void call( B *b )
{
// you do not need to switch on typeid. since the virtual
// function will do it for you automagically I am also assuming
// that this "call" function will call y.
// if you need to remap T1 and T2 to some other type
// do NOT switch on typeid, use a template type function instead.
b->template y<T1,T2>();
}
}

inline void B::x()
{
Base *pSomePtr = new A<int, float>();
pSomePtr->call( this );
// WooHoo!! Leak more memory!!
};

// Honestly though, with such a cyclic dependency between
// class A and B, are you sure you want to do this at all?
Feb 21 '07 #3
On Feb 21, 8:08 am, John Harrison <john_androni.. .@hotmail.comwr ote:
stefan.bruck... @gmail.com wrote:
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.
I'm imagining something like this - I know that it can't work like
this, but I would like to achieve a similarly simple syntax:
class Base
{
public:
virtual void call(...) = 0;
}
template <class T1,class T2>
class A : public Base
{
public:
void call(...)
{
if (typeid(T1) == ...)
...
else if (...)
...
else if (...)
...
}
}
class B
{
public:
void x()
{
Base *pSomePtr = ...;
pSomePtr->call(this,&B:: y);
};
template <class T1,class T2>
void y()
{
// do stuff
};
};
Any help on how I could realize this would be greatly appreciated .
Thanks,
Stefan

This works for me, and it isn't retricted to a known set of template
parameters. But it doesn't pass the member function to be called to the
call method. I wasn't sure if that was part of your requirements or not.

john

#include <iostream>

class B;

class Base
{
public:
virtual void call(B* b) = 0;

};

class B
{
public:

void x(Base *pSomePtr)
{
pSomePtr->call(this);
};

template <class T1,class T2>
void y()
{
std::cout << typeid(T1).name () << ' ' << typeid(T2).name () << '\n';
};

};

template <class T1, class T2>
class A : public Base
{
public:
void call(B* b)
{
b->y<T1, T2>();
}

};

int main()
{
A<int, doublea;
B b;
b.x(&a);

}
Thanks for your reply. Sorry I forgot to mention this, but
unfortunately it is one of the key requirements to specify the member
function to be called, so you can do somthing like this:

class B
{
public:

void x(Base *pSomePtr, Base *pSomeOtherPtr)
{
pSomePtr->call(this,&B:: dosomething);
pSomePtr->call(this,&B:: dosomethingelse );
pSomeOtherPtr->call(this,&B:: doanotherthing) ;
};
template <class T1,class T2>
void dosomething()
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};

template <class T1,class T2>
void dosomethingelse ()
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};

template <class T1,class T2>
void doanotherthing( )
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};
};

If it wasn't for that, I guess your solution would be ideal. The
problem with what I want is - of course - that it's impossible using
member function pointers. So I'm looking for something that would
provide a similarly nice syntax.

--Stefan

Feb 21 '07 #4
Piyo wrote:
>

Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).
I can't remember the rules for ->template. I know it's purpose is to
disambiguate the syntax for the compiler, so I add it if the compiler is
complaining. If the compiler isn't complaining I figure there is nothing
to disambiguate.

john
Feb 21 '07 #5
On Feb 21, 8:50 am, John Harrison <john_androni.. .@hotmail.comwr ote:
Piyo wrote:
Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).

I can't remember the rules for ->template. I know it's purpose is to
disambiguate the syntax for the compiler, so I add it if the compiler is
complaining. If the compiler isn't complaining I figure there is nothing
to disambiguate.

john
Thanks for your replies. Maybe I should explain the scenario in a bit
more detail:

Class Base is actually something called a Resource, which can be an
Array, Image, Volume, etc.

Class A is one type of Resource, e.g a Volume. The voxels of the
volume can have different types (char,int,float ,...) and number of
components (1,2,...).

Class B wants to perform some processing on a resource, for any type
and any number of components. The algorithm will, in general, be
independent of type and components (but there also might be the need
for partial specialization for some types/number of components).

All class B gets is a pointer to a resource and now it wants to call
some member of the resource class which determines the actual type of
resource and its voxel type and components and calls and appropriate
templated member which I want to specify. The actual implementation of
the algorithm is performance critical, so everything should be
statically typed after this point.

--Stefan

Feb 21 '07 #6
st************* @gmail.com wrote:
On Feb 21, 8:08 am, John Harrison <john_androni.. .@hotmail.comwr ote:
>stefan.bruck.. .@gmail.com wrote:
>>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.
I'm imagining something like this - I know that it can't work like
this, but I would like to achieve a similarly simple syntax:
class Base
{
public:
virtual void call(...) = 0;
}
template <class T1,class T2>
class A : public Base
{
public:
void call(...)
{
if (typeid(T1) == ...)
...
else if (...)
...
else if (...)
...
}
}
class B
{
public:
void x()
{
Base *pSomePtr = ...;
pSomePtr->call(this,&B:: y);
};
template <class T1,class T2>
void y()
{
// do stuff
};
};
Any help on how I could realize this would be greatly appreciated .
Thanks,
Stefan
This works for me, and it isn't retricted to a known set of template
parameters. But it doesn't pass the member function to be called to the
call method. I wasn't sure if that was part of your requirements or not.

john

#include <iostream>

class B;

class Base
{
public:
virtual void call(B* b) = 0;

};

class B
{
public:

void x(Base *pSomePtr)
{
pSomePtr->call(this);
};

template <class T1,class T2>
void y()
{
std::cout << typeid(T1).name () << ' ' << typeid(T2).name () << '\n';
};

};

template <class T1, class T2>
class A : public Base
{
public:
void call(B* b)
{
b->y<T1, T2>();
}

};

int main()
{
A<int, doublea;
B b;
b.x(&a);

}

Thanks for your reply. Sorry I forgot to mention this, but
unfortunately it is one of the key requirements to specify the member
function to be called, so you can do somthing like this:

class B
{
public:

void x(Base *pSomePtr, Base *pSomeOtherPtr)
{
pSomePtr->call(this,&B:: dosomething);
pSomePtr->call(this,&B:: dosomethingelse );
pSomeOtherPtr->call(this,&B:: doanotherthing) ;
};
template <class T1,class T2>
void dosomething()
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};

template <class T1,class T2>
void dosomethingelse ()
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};

template <class T1,class T2>
void doanotherthing( )
{
std::cout << typeid(T1).name () << ' ' <<
typeid(T2).name () << '\n';
};
};

If it wasn't for that, I guess your solution would be ideal. The
problem with what I want is - of course - that it's impossible using
member function pointers. So I'm looking for something that would
provide a similarly nice syntax.

--Stefan
This is the best I could do with the existing example
code. I could not figure out how to deal with function
template-ids since I am not sure if they can be easily
substituted for class template-ids. Thus, I had to
manually, instantiate the member function down below.

BTW, based on your real specs, I will post a different
idea for you. This one I think does not fit well BUT
you can learn a lot from this, I believe.

------------------------------------------------------
#include <boost/function.hpp>

class B;
class Base
{
public:
typedef boost::function <void (B*)Functor;
virtual void call( B *b, Functor func ) =0;
virtual void getFunctor() = 0;
};

// had to move the definition of B up due to dependency.
class B
{
public:
void x();

template<class T1, class T2>
void y()
{
}

template<class T1, class T2>
void z()
{
}
};

template <class T1,class T2>
class A : public Base
{
public:
virtual void call( B *b, boost::function <int (B*)func )
{
// apply functor
func( b );
}
}

inline void B::x()
{
Base *pSomePtr = new A<int, float>();
pSomePtr->call( this, &B::y<int,float );
pSomePtr->call( this, &B::z<int,float );
};
Feb 21 '07 #7
st************* @gmail.com wrote:
On Feb 21, 8:50 am, John Harrison <john_androni.. .@hotmail.comwr ote:
>Piyo wrote:
>>Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).
I can't remember the rules for ->template. I know it's purpose is to
disambiguate the syntax for the compiler, so I add it if the compiler is
complaining. If the compiler isn't complaining I figure there is nothing
to disambiguate.

john

Thanks for your replies. Maybe I should explain the scenario in a bit
more detail:

Class Base is actually something called a Resource, which can be an
Array, Image, Volume, etc.

Class A is one type of Resource, e.g a Volume. The voxels of the
volume can have different types (char,int,float ,...) and number of
components (1,2,...).

Class B wants to perform some processing on a resource, for any type
and any number of components. The algorithm will, in general, be
independent of type and components (but there also might be the need
for partial specialization for some types/number of components).

All class B gets is a pointer to a resource and now it wants to call
some member of the resource class which determines the actual type of
resource and its voxel type and components and calls and appropriate
templated member which I want to specify. The actual implementation of
the algorithm is performance critical, so everything should be
statically typed after this point.

--Stefan
So here is my new suggestion. Based on this description, you seem to
be pushing the responsibility of knowing how to apply the algorithm
properly onto the algorithm. This is not the best way to do it. Since
your algorithm is independent of type and components, you can
encapsulate it as a templated functor. Then inside each concrete
Resource, you instantiate as many as Processors as you need for
each component you need to process and do the processing.

I sure hope this helps :)

-------------------------------------------------------------------
#include <boost/function.hpp>

template<typena me T1>
class Proc
{
public:
T1 operator()( const T1 &val )
{
// process
}
};

class Resource
{
virtual void applyProc() = 0;
};

template<typena me T1>
class Array
{
virtual void applyProc()
{
Proc<T1processo r;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_internal[i] = processor( m_internal[i] );
}
}
private:
std::vector<T1m _internal;
};

template<typena me T1, typename T2>
class Image
{
virtual void applyProc()
{
Proc<T1processo r1;
Proc<T2processo r2;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_first[i] = processor1( m_first[i] );
m_second[i] = processor2( m_second[i] );
}
}
private:
std::vector<T1m _first;
std::vector<T2m _second;
};

template<typena me T1, typename T2, typename T3>
class Volume
{
// .. you get the picture
};
Feb 21 '07 #8
On Feb 21, 10:28 am, Piyo <cybermax...@ya hoo.comwrote:
stefan.bruck... @gmail.com wrote:
On Feb 21, 8:50 am, John Harrison <john_androni.. .@hotmail.comwr ote:
Piyo wrote:
>Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).
I can't remember the rules for ->template. I know it's purpose is to
disambiguate the syntax for the compiler, so I add it if the compiler is
complaining. If the compiler isn't complaining I figure there is nothing
to disambiguate.
john
Thanks for your replies. Maybe I should explain the scenario in a bit
more detail:
Class Base is actually something called a Resource, which can be an
Array, Image, Volume, etc.
Class A is one type of Resource, e.g a Volume. The voxels of the
volume can have different types (char,int,float ,...) and number of
components (1,2,...).
Class B wants to perform some processing on a resource, for any type
and any number of components. The algorithm will, in general, be
independent of type and components (but there also might be the need
for partial specialization for some types/number of components).
All class B gets is a pointer to a resource and now it wants to call
some member of the resource class which determines the actual type of
resource and its voxel type and components and calls and appropriate
templated member which I want to specify. The actual implementation of
the algorithm is performance critical, so everything should be
statically typed after this point.
--Stefan

So here is my new suggestion. Based on this description, you seem to
be pushing the responsibility of knowing how to apply the algorithm
properly onto the algorithm. This is not the best way to do it. Since
your algorithm is independent of type and components, you can
encapsulate it as a templated functor. Then inside each concrete
Resource, you instantiate as many as Processors as you need for
each component you need to process and do the processing.

I sure hope this helps :)

-------------------------------------------------------------------
#include <boost/function.hpp>

template<typena me T1>
class Proc
{
public:
T1 operator()( const T1 &val )
{
// process
}

};

class Resource
{
virtual void applyProc() = 0;

};

template<typena me T1>
class Array
{
virtual void applyProc()
{
Proc<T1processo r;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_internal[i] = processor( m_internal[i] );
}
}
private:
std::vector<T1m _internal;

};

template<typena me T1, typename T2>
class Image
{
virtual void applyProc()
{
Proc<T1processo r1;
Proc<T2processo r2;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_first[i] = processor1( m_first[i] );
m_second[i] = processor2( m_second[i] );
}
}
private:
std::vector<T1m _first;
std::vector<T2m _second;

};

template<typena me T1, typename T2, typename T3>
class Volume
{
// .. you get the picture

};- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -
Well ... hmmmm ... the problem is that different algorithms are
performed on resources from basically all over the place. A plugin to
the application might implement a specific algorithms, for example. In
your solution, the basic problem remains:

Lets say, I now have Proc1, Proc2 and Proc3, all do different things.
At runtime, any one of them could be applied to a resource.

So I would need to pass an instance of Proc1, Proc2, or, Proc3 to
applyProc -- but that doesn't work because I don't know which
instance, since I don't know the template parameters of the resource.

Feb 21 '07 #9
st************* @gmail.com wrote:
On Feb 21, 10:28 am, Piyo <cybermax...@ya hoo.comwrote:
>stefan.bruck.. .@gmail.com wrote:
>>On Feb 21, 8:50 am, John Harrison <john_androni.. .@hotmail.comwr ote:
Piyo wrote:
Darn, you beat me to it!! :) Interestingly enough, we came up
with the same solution. BTW, I forgot (so I went and included
it in my solution) do you need to do ->template in the call
to member function y()? (See below).
I can't remember the rules for ->template. I know it's purpose is to
disambigua te the syntax for the compiler, so I add it if the compiler is
complainin g. If the compiler isn't complaining I figure there is nothing
to disambiguate.
john
Thanks for your replies. Maybe I should explain the scenario in a bit
more detail:
Class Base is actually something called a Resource, which can be an
Array, Image, Volume, etc.
Class A is one type of Resource, e.g a Volume. The voxels of the
volume can have different types (char,int,float ,...) and number of
components (1,2,...).
Class B wants to perform some processing on a resource, for any type
and any number of components. The algorithm will, in general, be
independent of type and components (but there also might be the need
for partial specialization for some types/number of components).
All class B gets is a pointer to a resource and now it wants to call
some member of the resource class which determines the actual type of
resource and its voxel type and components and calls and appropriate
templated member which I want to specify. The actual implementation of
the algorithm is performance critical, so everything should be
statically typed after this point.
--Stefan
So here is my new suggestion. Based on this description, you seem to
be pushing the responsibility of knowing how to apply the algorithm
properly onto the algorithm. This is not the best way to do it. Since
your algorithm is independent of type and components, you can
encapsulate it as a templated functor. Then inside each concrete
Resource, you instantiate as many as Processors as you need for
each component you need to process and do the processing.

I sure hope this helps :)

-------------------------------------------------------------------
#include <boost/function.hpp>

template<typen ame T1>
class Proc
{
public:
T1 operator()( const T1 &val )
{
// process
}

};

class Resource
{
virtual void applyProc() = 0;

};

template<typen ame T1>
class Array
{
virtual void applyProc()
{
Proc<T1processo r;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_internal[i] = processor( m_internal[i] );
}
}
private:
std::vector<T1m _internal;

};

template<typen ame T1, typename T2>
class Image
{
virtual void applyProc()
{
Proc<T1processo r1;
Proc<T2processo r2;
for( unsigned int i=0; i < m_internal.size (); ++i )
{
m_first[i] = processor1( m_first[i] );
m_second[i] = processor2( m_second[i] );
}
}
private:
std::vector<T1m _first;
std::vector<T2m _second;

};

template<typen ame T1, typename T2, typename T3>
class Volume
{
// .. you get the picture

};- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Well ... hmmmm ... the problem is that different algorithms are
performed on resources from basically all over the place. A plugin to
the application might implement a specific algorithms, for example. In
your solution, the basic problem remains:

Lets say, I now have Proc1, Proc2 and Proc3, all do different things.
At runtime, any one of them could be applied to a resource.

So I would need to pass an instance of Proc1, Proc2, or, Proc3 to
applyProc -- but that doesn't work because I don't know which
instance, since I don't know the template parameters of the resource.
The problem is you cannot pass Proc1, Proc2 or Proc3 since they are
Template-ids and not real functions. Another problem you are
encountering is the ability to determine template parameters from the
NON-template base class. There is a lot of mixing of compile-time and
run-time polymorphism here which spells trouble.

Feb 21 '07 #10

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

Similar topics

3
2010
by: Gianni Mariani | last post by:
I was a little surprised by this: It seems like the code below should not compile but the Comeau 4.3.3 compiler accepts it and the gcc 3.4(prerel) compiler rejects it and MSVC++7.1 ICE's. 14.6.1 in the standard seems to imply that template parameters are hidden by class members. struct X
4
2736
by: wkaras | last post by:
I would like to propose the following changes to the C++ Standard, the goal of which are to provide an improved ability to specify the constraints on type parameters to templates. Let me say from the start that my knowledge of compiler implementation is very limited. Therefore, my suggestions may have to be rejected because they are difficult or impossible to implement. The proposal is based on the concept of "type similarity". Type...
3
1747
by: Erik Wikström | last post by:
I've been trying for a while now to understand how template template parameters work. But I just can't wrap my head around it and was hoping that someone might help me. As best I can figure the code should look something like this: template<template<typename S> typename T> struct element_traits { typedef S type; };
6
2811
by: rincewind | last post by:
Hi, can anybody summarise all options for partial template specialization, for all kind of parameters (type, nontype, template)? I *think* I understand options for partial specialization on type parameters - in place of a template argument one can construct arbitrary valid C++ type declaration, more or less like in "typedef" statement. What about nontype parameters? Am I right that you cannot partially
4
3105
by: Dan Krantz | last post by:
I have the following template to ensure that a given number (val) falls into a range (between vmin & vmax): template<typename T> T ForceNumericRange( const T& val, const T& vmin, const T& vmax) { T retVal = val; if ( retVal < vmin ) retVal = vmin;
8
3861
by: Paul Roberts | last post by:
Hi, I'm hoping somebody here can help me with a simple problem of template syntax. Here's an example: template<typename T, int iclass A { static int a;
2
1856
by: desktop | last post by:
I have this code from the book C++ Templates: The Complete Guide: #ifndef ACCUM8_HPP_ #define ACCUM8_HPP_ #include "accumtraits4.hpp" #include "sumpolicy2.hpp"
8
5317
by: Jess | last post by:
Hi, I have a template function that triggered some compiler error. The abridged version of the class and function is: #include<memory> using namespace std; template <class T>
8
2968
by: flopbucket | last post by:
Hi, I want to provide a specialization of a class for any type T that is a std::map. template<typename T> class Foo { // ... };
0
10145
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...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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
8822
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...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
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.