473,695 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reference object when using STL

Hello Experts!!

This class template and main works perfectly fine.
I have this class template called Handle that has a pointer declared as T*
body;
As you can see I have a reference counter in the class template so I know
how many references I have to the body. In my case it's the Integer wrapper
class which is the body.
This template works for many different types.
The one that I use is named Integer and is a Wrapper for an int. The code
for this is not include
because it doesn't add any futher information.
At the bottom I have a main.
In main I can call the stand alone function addNodeToSTL plus many more to
add nodes to the STL list container named myList1.
Here is the stand-alone function that add nodes to the STL list container.
void addNodeToSTL(li st<handle_t>* myList)
{
handle_t myh(new Integer(getValu e("Ange vardet som du vill lagga in i
listan/listorna: ")));
myList->push_front(myh );
}

This handle_t is typedef to
typedef Handle<Integer> handle_t;
Now to my question when I add nodes to a STL container what is actually a
referenceobject in my case.

Is it something that STL has internally or is it my class template Handle.?

template<class T>
class Handle
{
public:
Handle()
{
body = new T(0);
ref_count = new int(1);
}

Handle(T* body_ptr) //Constructor
{
body = body_ptr;
cout << "Body adressen = " << body << endl;
ref_count = new int(1);
}

~Handle() //Destructor
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
}

T operator*() const { return *body; }

T& operator*()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return *body;
}

T* operator->()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return body;
}

T* operator->() const { return body; }
bool operator==(cons t T& h) { return *body == h; }
bool operator==(cons t Handle& h) { return *body == *h.body; }

Handle(const Handle& h)
{
body = h.body;
ref_count = h.ref_count;
(*ref_count)++;
}

int getRefCount() { return *ref_count; }
void operator()(Hand le& h) { cout << *h.body << endl; }

const Handle& operator=(const Handle& h)
{
if (this != &h)
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
(*h.ref_count)+ +;
}
return *this;
}

private:
T* body;
int* ref_count;

void deleteAll()
{
delete body;
body = NULL;
delete ref_count;
ref_count = NULL;
}
};

void addNodeToSTL(li st<handle_t>* myList)
{
handle_t myh(new Integer(getValu e("Ange vardet som du vill lagga in i
listan/listorna: ")));
myList->push_front(myh );
}
typedef Handle<Integer> handle_t;

int main()
{
list<handle_t>* myList1 = new list<handle_t>;
list<handle_t>* myList2 = new list<handle_t>;
do
{
switch (huvudMeny())

{
case 0: return 0;
case 1: addNodeToSTL(my List1);
break;
case 2: displaySTL(myLi st1, myList2);
break;
case 3: deleteSelectedV alue(myList1);
break;
case 4: deleteAll(myLis t1);
break;
case 5: findSelectedVal ue(myList1);
break;
case 6: testOperatorSta r(myList1);
break;
case 7: testOperatorArr ow(myList1);
break;
case 8: copyList(myList 1, myList2);
break;
}
} while(1);
return 0;
}

//Many thanks

//Tony
Aug 21 '05 #1
10 2266
Tony Johansson wrote:
Hello Experts!!

This class template and main works perfectly fine.
We shall see about that.
I have this class template called Handle that has a pointer declared as
T* body;
As you can see I have a reference counter in the class template so I know
how many references I have to the body.
Ok. So the idea is to execute

delete body

when the reference count drops to 0.
In my case it's the Integer
wrapper class which is the body.
This template works for many different types.
The one that I use is named Integer and is a Wrapper for an int. The code
for this is not include
because it doesn't add any futher information.
At the bottom I have a main.
In main I can call the stand alone function addNodeToSTL plus many more
to add nodes to the STL list container named myList1.
Here is the stand-alone function that add nodes to the STL list container.
void addNodeToSTL(li st<handle_t>* myList)
{
handle_t myh(new Integer(getValu e("Ange vardet som du vill lagga in i
listan/listorna: ")));
myList->push_front(myh );
}

This handle_t is typedef to
typedef Handle<Integer> handle_t;
Now to my question when I add nodes to a STL container what is actually a
referenceobject in my case.

Is it something that STL has internally or is it my class template
Handle.?
That, actually is up to the implementation and also might depend on which
container you are using: I would implement std::vector<X> in such a way
that it just stores objects of type X, however std::map<X> would be a tree
structure and the nodes, for which storage would be allocated might look
like this:

template < typename X >
class map_node {

X data;
map_node * right;
map_node * left;
map_node * parent;

....

}; // clas map_node<X>

In any case, your code should not rely on any assumptions about the internal
workings of standard containers nor iterators nor algorithms.

Now for your reference counted pointer:

template<class T>
class Handle
{
public:
Handle()
{
body = new T(0);
ref_count = new int(1);
}
a) Why is T constructible from 0?
b) Why not initialize:

Handle ()
: body ( new T () )
, ref_count ( new int (1) )
{}

c) Still, just being picky: if new int(1) fails, body will leak memory.

So, maybe we are back to not initializing:

Handle () {
std::auto_ptr<T > b_tmp = new T();
ref_count = new int (1);
body = b_tmp.release() ;
}

Handle(T* body_ptr) //Constructor
{
body = body_ptr;
cout << "Body adressen = " << body << endl;
ref_count = new int(1);
}
There is a similar problem here, although one could argue that in this case
the caller could handle it by catching an exception.

~Handle() //Destructor
{
(*ref_count)--;
if (!*ref_count)
Make that

if ( *ref_count == 0 )

after all that is what you want to communicate to the reader: the number of
references is 0.
deleteAll();
}

T operator*() const { return *body; }
You might consider

T const & operator*() const { return *body; }

T& operator*()
{
if (*ref_count > 1)
{
(*ref_count)--;
-- (*ref_count)
; body = new T(*body);
ref_count = new int(1);
leak (see above)
}
return *body;
}
This seems to implement an interesting piece of lazy copy semantics.


T* operator->()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return body;
}
Same comments as for T&

T* operator->() const { return body; }
Probably you meant:

T const * operator->() const { return body; }

bool operator==(cons t T& h) { return *body == h; }
bool operator==(cons t Handle& h) { return *body == *h.body; }
You might consider forwarding < as well so that you could use std::sort and
std::set for these handles.
Handle(const Handle& h)
{
body = h.body;
ref_count = h.ref_count;
(*ref_count)++;
}
Looks cool.
int getRefCount() { return *ref_count; }
void operator()(Hand le& h) { cout << *h.body << endl; }

const Handle& operator=(const Handle& h)
{
if (this != &h)
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
(*h.ref_count)+ +;
}
return *this;
}
Hm, what about:

Hande & operator= ( Handle const & other ) {
Handle dummy ( other );
swap( *this, dummy );
return( *this );
}

and have some friend function

swap ( Handle & a, Handle & b ) {
swap( a.body, b.body );
swap( a.ref_count, b.ref_count );
}

Note how this assignment operator delegates all the tricky stuff to the copy
constructor and the destructor: the ref_counting is done when dummy is
destroyed. Thus you only have to get copy constructor and destructor right.
In particular, if the copy constructor is exception safe, then so is the
assignment operator.
private:
T* body;
int* ref_count;

void deleteAll()
{
delete body;
body = NULL;
delete ref_count;
ref_count = NULL;
}
};

void addNodeToSTL(li st<handle_t>* myList)
{
handle_t myh(new Integer(getValu e("Ange vardet som du vill lagga in i
listan/listorna: ")));
myList->push_front(myh );
}
typedef Handle<Integer> handle_t;

int main()
{
list<handle_t>* myList1 = new list<handle_t>;
list<handle_t>* myList2 = new list<handle_t>;
do
{
switch (huvudMeny())

{
case 0: return 0;
case 1: addNodeToSTL(my List1);
break;
case 2: displaySTL(myLi st1, myList2);
break;
case 3: deleteSelectedV alue(myList1);
break;
case 4: deleteAll(myLis t1);
break;
case 5: findSelectedVal ue(myList1);
break;
case 6: testOperatorSta r(myList1);
break;
case 7: testOperatorArr ow(myList1);
break;
case 8: copyList(myList 1, myList2);
break;
}
} while(1);
return 0;
}

//Many thanks

//Tony


Aug 21 '05 #2
Hello//
Thanks for many good suggestions about the code but I one more question.

This code for assignement operator and cpy-ctor. I thing the order is wrong
I must have statement
ref_count = h.ref_count; after
(*h.ref_count)+ +;
Now it's before so that's wrong order.
It's the same order mistake in both assignment operator and the cpy-ctor. Do
you agree with me.?
Handle(const Handle& h)
{
body = h.body;
ref_count = h.ref_count;
(*ref_count)++;
}

const Handle& operator=(const Handle& h)
{
if (this != &h)
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
(*h.ref_count)+ +;
}
return *this;
}

//Tony
Aug 21 '05 #3
I forgot to mention one thing:

Kai-Uwe Bux wrote:

T& operator*()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return *body;
}


This seems to implement an interesting piece of lazy copy semantics.


Note that this copy semantics implies that your handle is unfit for holding
pointers whose type varies polymorphically . The line:

body = new T(*body);

will cheerfully slice any object derived from T.

Best

Kai-Uwe Bux
Aug 21 '05 #4
Tony Johansson wrote:
Hello//
Thanks for many good suggestions about the code but I one more question.

This code for assignement operator and cpy-ctor. I thing the order is
wrong I must have statement
ref_count = h.ref_count; after
(*h.ref_count)+ +;
Now it's before so that's wrong order.
It's the same order mistake in both assignment operator and the cpy-ctor.
Do you agree with me.?
Handle(const Handle& h)
{
body = h.body;
ref_count = h.ref_count;
(*ref_count)++;
This works. So do:

ref_count = h.ref_count;
++ (*h.ref_count);

and:

++ (*h.ref_count);
ref_count = h.ref_count;

The only version that fails is:

++ (*ref_count);
ref_count = h.ref_count;
const Handle& operator=(const Handle& h)
{
if (this != &h)
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
(*h.ref_count)+ +;
}
return *this;
}


this works. So would:

(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
++(*ref_count);

and

(*ref_count)--;
if (!*ref_count)
deleteAll();
body = h.body;
++(*h.ref_count );
ref_count = h.ref_count;


More generally: suppose you have two pointers a_ptr and b_ptr, then

a_ptr = b_ptr;
do something to *a_ptr;

and

a_ptr = b_ptr;
do something to *b_ptr;

and

do something to *b_ptr;
a_ptr = b_ptr;

are equivalent for reasonably unsurprising values of something and
reasonably dumb pointer types.
Nonetheless, I would strongly recommend to ditch the assignment operator in
favor of a swap-based implementation: the code is much more easy to
understand.

Best

Kai-Uwe Bux

PS: all this breaks in the presence of multiple threads messing around.

PPS: since you have this copy semantics anyway, you could ditch reference
counting alltogether (untested code, might not even compile):

template < typename T >
copy_ptr {

T * raw_ptr;

public:

copy_ptr ( copy_ptr const & other )
: raw_ptr ( new T ( *(other.raw_ptr ) ) )
{}

copy_ptr ( T value = T() )
: raw_ptr ( new T ( value ) )
{}

~copy_ptr ( void ) {
delete raw_ptr;
}

copy_ptr & operator= ( copy_ptr const & other ) {
copy_ptr dummy ( other );
swap( this->raw_ptr, dummy.raw_ptr );
return( *this );
}

T const * operator-> ( void ) const {
return( raw_ptr );
}

T * operator-> ( void ) {
return( raw_ptr );
}

T const & operator-> ( void ) const {
return( raw_ptr );
}

T & operator-> ( void ) {
return( raw_ptr );
}

bool operator< ( copy_ptr const & other ) const {
return( *(this->raw_ptr) < *(other.raw_ptr ) );
}

bool operator== ( copy_ptr const & other ) const {
return( *(this->raw_ptr) == *(other.raw_ptr ) );
}

}; // copy_ptr<T>

Note a few differences:

a) No constructor from T* is provided. This guarantees that there always
will be a valid pointee since construction from 0 is prevented.

b) Every assignment creates a copy of the pointee. The advantage is: we do
not need reference counting, the disadvantage is a certain overhead cost
from assignments.

c) Since the class contains only one pointer field, the auto_ptr trickery is
no longer needed to deal with throws from new().
Aug 21 '05 #5

Kai-Uwe Bux wrote:
I forgot to mention one thing:

Kai-Uwe Bux wrote:

T& operator*()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return *body;
}


This seems to implement an interesting piece of lazy copy semantics.


Note that this copy semantics implies that your handle is unfit for holding
pointers whose type varies polymorphically . The line:

body = new T(*body);

will cheerfully slice any object derived from T.

Best

Kai-Uwe Bux


No, there is no slicing, just a memory leak. For one, we know body is a
T* since the class initialized it that way. Second, the argument to the
constructor, even though it is dereferenced is still being passed by
reference. Slicing requires copying by value. Third, would body really
be constructed any differently whether initialized with a T or a
subclass of T? I don't see any realistic way that it could matter, but
the question is moot anyway owing to the first two reasons.

Greg

Aug 21 '05 #6
Greg wrote:

Kai-Uwe Bux wrote:
I forgot to mention one thing:

Kai-Uwe Bux wrote:

>> T& operator*()
>> {
>> if (*ref_count > 1)
>> {
>> (*ref_count)--;
>> body = new T(*body);
>> ref_count = new int(1);
>> }
>> return *body;
>> }
>
> This seems to implement an interesting piece of lazy copy semantics.


Note that this copy semantics implies that your handle is unfit for
holding pointers whose type varies polymorphically . The line:

body = new T(*body);

will cheerfully slice any object derived from T.

Best

Kai-Uwe Bux


No, there is no slicing, just a memory leak. For one, we know body is a
T* since the class initialized it that way. Second, the argument to the
constructor, even though it is dereferenced is still being passed by
reference. Slicing requires copying by value. Third, would body really
be constructed any differently whether initialized with a T or a
subclass of T? I don't see any realistic way that it could matter, but
the question is moot anyway owing to the first two reasons.

Greg

Let me exsplain what I mean: Below you find the code for Handle<T> as given
by the OP. Then I demonstrate in main() a case of what I consider slicing.
Now, I might be mistaken about terminology, but I am pretty sure that the
program below demonstrates Handle<T> to be unfit for polymorphic use.
#include <iostream>
using namespace std;

template<class T>
class Handle
{
public:
Handle()
{
body = new T(0);
ref_count = new int(1);
}

Handle(T* body_ptr) //Constructor
{
body = body_ptr;
cout << "Body adressen = " << body << endl;
ref_count = new int(1);
}

~Handle() //Destructor
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
}

T operator*() const { return *body; }

T& operator*()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return *body;
}

T* operator->()
{
if (*ref_count > 1)
{
(*ref_count)--;
body = new T(*body);
ref_count = new int(1);
}
return body;
}

T* operator->() const { return body; }
bool operator==(cons t T& h) { return *body == h; }
bool operator==(cons t Handle& h) { return *body == *h.body; }

Handle(const Handle& h)
{
body = h.body;
ref_count = h.ref_count;
(*ref_count)++;
}

int getRefCount() { return *ref_count; }
void operator()(Hand le& h) { cout << *h.body << endl; }

const Handle& operator=(const Handle& h)
{
if (this != &h)
{
(*ref_count)--;
if (!*ref_count)
deleteAll();
ref_count = h.ref_count;
body = h.body;
(*h.ref_count)+ +;
}
return *this;
}

private:
T* body;
int* ref_count;

void deleteAll()
{
delete body;
body = NULL;
delete ref_count;
ref_count = NULL;
}
};
struct Base {

virtual
~Base () {}

virtual
int get_value ( void ) const { return 314; }

};

struct Derived : public Base {

virtual
~Derived () {}

virtual
int get_value ( void ) const { return 272; }

};
typedef Handle< Base > base_handle;

int main() {
base_handle a_ptr ( new Derived() );
base_handle b_ptr ( new Base() );
b_ptr = a_ptr;

std::cout << b_ptr->get_value() << " != " << a_ptr->get_value() << '\n';
}
It so happens that the information about the dynamic type of the object is
lost in the assignment:

news_group> a.out
Body adressen = 0x804a050
Body adressen = 0x804a070
272 != 314

Best

Kai-Uwe Bux
Aug 21 '05 #7

Kai-Uwe Bux wrote:
Greg wrote:

Kai-Uwe Bux wrote:
I forgot to mention one thing:

Kai-Uwe Bux wrote:
>> T& operator*()
>> {
>> if (*ref_count > 1)
>> {
>> (*ref_count)--;
>> body = new T(*body);
>> ref_count = new int(1);
>> }
>> return *body;
>> }
>
> This seems to implement an interesting piece of lazy copy semantics.

Note that this copy semantics implies that your handle is unfit for
holding pointers whose type varies polymorphically . The line:

body = new T(*body);

will cheerfully slice any object derived from T.

Best

Kai-Uwe Bux


No, there is no slicing, just a memory leak. For one, we know body is a
T* since the class initialized it that way. Second, the argument to the
constructor, even though it is dereferenced is still being passed by
reference. Slicing requires copying by value. Third, would body really
be constructed any differently whether initialized with a T or a
subclass of T? I don't see any realistic way that it could matter, but
the question is moot anyway owing to the first two reasons.

Greg

Let me exsplain what I mean: Below you find the code for Handle<T> as given
by the OP. Then I demonstrate in main() a case of what I consider slicing.
Now, I might be mistaken about terminology, but I am pretty sure that the
program below demonstrates Handle<T> to be unfit for polymorphic use.


Technically, it's not slicing since Derived remains intact, but the
overall effect is the same. The fix for this problem and the memory
leak is not to allocate a new T in the * and -> operators but to simply
return the existing body member variable.

Greg

Aug 22 '05 #8
Greg wrote:

Kai-Uwe Bux wrote:
Greg wrote:
>
> Kai-Uwe Bux wrote:
>> I forgot to mention one thing:
>>
>> Kai-Uwe Bux wrote:
>>
>>
>> >> T& operator*()
>> >> {
>> >> if (*ref_count > 1)
>> >> {
>> >> (*ref_count)--;
>> >> body = new T(*body);
>> >> ref_count = new int(1);
>> >> }
>> >> return *body;
>> >> }
>> >
[snip] Technically, it's not slicing since Derived remains intact, but the
overall effect is the same.
Since you seem to know: what is the technical definition of slicing?
The fix for this problem and the memory
leak is not to allocate a new T in the * and -> operators but to simply
return the existing body member variable.


a) Where do you see a memory leak?

b) Would your fix not change the semantics? Consider

Handle< T > a_ptr;
Handle< T > b_ptr;

...

a_ptr = b_ptr;
a_ptr->some_non_const _function();

The current implementation will in the last line create an individual copy
of the data just for a_ptr to own. Thus *b_ptr will not be affected by the
call. Your fix would change that.

Best

Kai-Uwe Bux
Aug 22 '05 #9
Kai-Uwe Bux wrote:
Greg wrote:

Kai-Uwe Bux wrote:
Greg wrote:

>
> Kai-Uwe Bux wrote:
>> I forgot to mention one thing:
>>
>> Kai-Uwe Bux wrote:
>>
>>
>> >> T& operator*()
>> >> {
>> >> if (*ref_count > 1)
>> >> {
>> >> (*ref_count)--;
>> >> body = new T(*body);
>> >> ref_count = new int(1);
>> >> }
>> >> return *body;
>> >> }
>> > [snip]
Technically, it's not slicing since Derived remains intact, but the
overall effect is the same.


Since you seem to know: what is the technical definition of slicing?


Slicing occurs when an instance of a derived class is copied into a
variable of a base class type. Since the base class is likely smaller
than any of its derived classess, the derived class will not fit in the
variable. The portion of the derived class that does not fit is thereby
"sliced" off during the copy.

There is an example of slicing in one of Handle's operators:

T operator*() const { return *body; }

Here the contents of body are copied into a variable of type T. If body
is actually a pointer to a derived class of T, then the object will be
"sliced" because there is only room for a T in the type being returned.
The fix for this problem and the memory
leak is not to allocate a new T in the * and -> operators but to simply
return the existing body member variable.


a) Where do you see a memory leak?

b) Would your fix not change the semantics? Consider

Handle< T > a_ptr;
Handle< T > b_ptr;

...

a_ptr = b_ptr;
a_ptr->some_non_const _function();

The current implementation will in the last line create an individual copy
of the data just for a_ptr to own. Thus *b_ptr will not be affected by the
call. Your fix would change that.


The current semantics of Handle are inconsistent. The const version of
Handle's -> operator returns a non-const T* object just like the non
const -> operator does. The client can therefore effectively modify
body without triggering the copy-on-write operation. The result will be
that some holder of a Handle will find that its value has unexpectedly
changed.

Greg

Aug 22 '05 #10

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

Similar topics

5
9491
by: Jan Pieter Kunst | last post by:
(apologies if this message is a duplicate -- my news server seems to have problems) Greetings, When using PHP 4, this: // ex. 1 class A { function A(&$obj) {
110
9918
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object must be an object instead of
11
2191
by: Doug | last post by:
Is there any harm in passing an object into a method with the 'ref' keyword if the object is already a reference variable? If not, is there any benefit?
3
4219
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page that needs the class module I get an error on web site: Object reference not set to an instance of an object Here is where the error is:
2
2586
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
2
3051
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
3
4399
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
12
2679
by: Andrew Bullock | last post by:
Hi, I have two classes, A and B, B takes an A as an argument in its constructor: A a1 = new A(); B b = new B(a1);
51
4442
by: Kuku | last post by:
What is the difference between a reference and a pointer?
275
12275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
8568
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9115
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
7660
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
6491
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
5839
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
4579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3003
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
2
2272
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1976
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.