![]() |
| | #241 | ||
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| Quote:
Besides, the headers use a lot of things like re-define of defines (without #undef first). Regardless if it ignores this or not, it's not allowed. If extensions are disabled, you get compile errors. Code: #define __$adt_prop(adt,prop)
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
Last edited by Elysia; 05-18-2008 at 08:31 AM. | ||
| Elysia is offline | |
| | #242 | |
| Registered User Join Date: Jan 2008
Posts: 642
| Quote:
Soma | |
| phantomotap is offline | |
| | #243 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| And yet the headers won't compile with language extensions OFF. And that is all we care about. If it can't compile them without extensions, then the headers are flawed, because they aren't standard compliant are they?
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #244 | |||
| Registered User Join Date: Jan 2008
Posts: 642
| Quote:
Quote:
Quote:
Soma | |||
| phantomotap is offline | |
| | #245 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| Well, we obviously have different views or do not understand each other, so I'll leave it at that. I have no further wish to argue.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #246 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| Another question I'm thinking on: Say that CIterator takes a constructor with int: CIterator(int) This is not enough information to properly construct the iterator, however. Therefore, it would want to ask the owner class to which it belongs or is constructed for for the rest of the information. Typically, it would do this via the proxy: m_pProxy->QueryRange(m_pRangeStart, m_pRangeEnd); However, since it's newly constructed, it doesn't have the owner class address or a valid proxy pointer, so it can't really do much. Now the question becomes - is it possible, then, to somehow pass along the address for the class for either the correct proxy instance or the owner class? The reason is that the int constructor is supposed to be an implicit constructor to should allow this: CStringEx test = "test"; test.Find("test", 0); Find's prototype would be: Find(const CStringEx& strFind, CIterator vStart); This would invoke the int constructor for CIterator for int. The constructor would then set itself to test.begin() + n. But I can't seem to find a viable solution for the iterator to get the address the owner class so as to be able to make this possible. Is it perhaps just too much of a hassle to make it possible?
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #247 | |
| The larch Join Date: May 2006
Posts: 3,222
| What about this? Code:
Find(const CStringEx& strFind, unsigned nPos)
{
CIterator vIter(nPos, this);
...
}
__________________ I might be wrong. Quote:
| |
| anon is offline | |
| | #248 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| That's one solution I didn't think of... it will probably mean two overloaded functions, but hey, who cares. Suppose I'll do that unless I can find a better solution. Thanks.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #249 | |
| The larch Join Date: May 2006
Posts: 3,222
| Code: Find(const CStringEx& strFind, unsigned nPos)
{
CIterator vIter(nPos, this);
return Find(strFind, vIter);
}
Find(const CStringEx& strFind, CIterator vStart)
{
...
}
__________________ I might be wrong. Quote:
| |
| anon is offline | |
| | #250 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| The functions will always accept T::iterator. Such as my current free Find function: Code: template<typename StrType> typename StrType::const_iterator Find(const StrType& strFind, const typename StrType::const_iterator& vStart, const typename StrType::const_iterator& vEnd);
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #251 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| But what if that iterator points into a different instance of StrType? That's what anon was asking. (Of course, in the STL, that's simply undefined, but you're not a fan of undefined behaviour.)
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #252 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| That would throw an exception. Code: if ( !vStart.valid_instance(strSrc) || !vEnd.valid_instance(strSrc) ) throw errInvalidIterator;
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
Last edited by Elysia; 05-20-2008 at 04:04 PM. | |
| Elysia is offline | |
| | #253 |
| Registered User Join Date: Jan 2008
Posts: 642
| Why not design the container/iterator model up such that the validate method is part of the iterator class? With such a design the validate method could examine the state of iterator for correctness and optionally update the owning container of the iterator if it was spawned from such constructs as this implicit conversion constructor. Soma |
| phantomotap is offline | |
| | #254 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| The valid_instance function is part of the iterator class. It takes a const reference to the base object to validate. It uses its proxy to query which owning object it's bound against and compares the address of the passed argument. If they don't match, it returns false. In other words, if the object passed through reference is an instance that is not the instance of the owning object, it returns false.
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
| |
| Elysia is offline | |
| | #255 | |
| Mysterious C++ User Join Date: Oct 2007
Posts: 14,785
| New wonder: I have the following free operator: Code: CTmplStringBaseTemplate CTmplStringBaseTmpl& operator += (CTmplStringBaseTmpl& rlhs, const CTmplStringBaseTmpl& rrhs); Code: Strings::CStringExW test( L"test" ); test += L"This is a test"; Code: error C2784: 'Strings::CTmplStringBase<T,Strings::StrTraits<T>> &Strings::operator += (Strings::CTmplStringBase<T,Strings::StrTraits<T>> &, const Strings::CTmplStringBase<T,Strings::StrTraits<T>> &)' : could not deduce template argument for 'const Strings::CTmplStringBase<T,Strings::StrTraits<T>> &' from 'const wchar_t [15]' Code: template<typename T> CTmplStringBase<T, StrTraits<T>>& operator += (CTmplStringBase<T, StrTraits<T>>& rlhs, const CTmplStringBase<T, StrTraits<T>>& rrhs/*const T* strData*/); Code: CTmplStringBase(); CTmplStringBase(const CTmplStringBase& rSrc); #ifdef _MFC_VER CTmplStringBase(const CStringT< T, StrTraitMFC_DLL<T> >& strSrc); #endif CTmplStringBase(const T* strData); CTmplStringBase(const T cData); CTmplStringBase(uint64_t nData); CTmplStringBase(int64_t nData); CTmplStringBase(long nData); I must be doing something wrong here...
__________________ Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System I dedicated my life to helping others. This is only a small sample of what they said: "Thanks Elysia. You're a programming master! How the hell do you know every thing?" Quoted... at least once. Quote:
Last edited by Elysia; 05-25-2008 at 07:24 AM. | |
| Elysia is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WS_POPUP, continuation of old problem | blurrymadness | Windows Programming | 1 | 04-20-2007 06:54 PM |
| Laptop Problem | Boomba | Tech Board | 1 | 03-07-2006 06:24 PM |
| implementation file | bejiz | C++ Programming | 5 | 11-28-2005 01:59 AM |
| Sorting problem.. well actually more of a string problem | fatdunky | C Programming | 5 | 11-07-2005 11:34 PM |
| Memory Problem - I think... | Unregistered | C Programming | 4 | 10-24-2001 12:14 PM |