473,660 Members | 2,459 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loki::Tuple and g++

I'm using g++, a quite new version.
Why does this code not compile?

#include "HierarchyGener ators.h"
using namespace Loki;
int main()
{
Tuple<TYPELIST_ 2(int,int)> tuple;
Field<0>(tuple) = 4;
};

--
Fabio.
Jul 23 '05 #1
1 1972
> I'm using g++, a quite new version.
Why does this code not compile?

#include "HierarchyGener ators.h"
using namespace Loki;
int main()
{
Tuple<TYPELIST_ 2(int,int)> tuple;
Field<0>(tuple) = 4;
};


I think that GenScatterHiera rchy has a bug when two or more equal types
exist in the Typelist.
The hierarchy generated is ambiguous (g++ emit a warning).

The implementation of Field<0>(tuple) uses this funcion:

template <class H, typename R, int i>
inline R& FieldHelper(H& obj, Type2Type<R> tt, Int2Type<i>)
{
typename H::RightBase& subobj = obj;
return FieldHelper(sub obj, tt, Int2Type<i- 1>());
}

The upcast from obj to subobj is ambiguous, because
H::RightBase is convertible to H::LeftBase.
In such a way the compiler doesn't know where to go.
Left or Right?

--
fabioppp
Jul 23 '05 #2

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

Similar topics

6
1611
by: J | last post by:
Does anyone know how to do this in C++ or if it can be done? And also to find out how many fields there are in a struct?
205
10593
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
2704
by: Jon Slaughter | last post by:
I'm having some issues using loki's typelists and I'm wondering if there is something I'm missing. I'm trying to create a template who's specialization sorta looks like template <int I, class T> struct Node { enum {Index = I}; typedef T Class;
18
2444
by: skishorev | last post by:
Hi, Here I am taking two functions. void f(int,int) and another one is float f(int,int). Is it possible to overload with return values. Thx, kishore
3
1792
by: alex | last post by:
I read the Loki source code, I doubt why use ScatterHierarchyTag head? ---------------------------------------------------------------------------------------------------------------- namespace Private { template<class, class> struct ScatterHierarchyTag; }
1
6497
by: Krivenok Dmitry | last post by:
Hello All! I have read about Loki's Typelist in "Modern C++ Design". Great idea! But this chapter of book describes only three example of Typelist usage (GenScatterHierarchy, GenLinearHierarchy and Tuple). Where can I find another examples of Typelists usage? Are there books or on-line articles?
10
2944
by: Ray | last post by:
I am reading Andrei Alexandrescu's book. The ideas presented there sound really good, but I wonder--is there really a lot of people using it? Or it's simply too esoteric for mortals? Cheers Ray
7
2516
by: abir | last post by:
In my program i wan to use a certain type as both type T1 (usually non-pod) and also T2 (usually size_t) so an union like this doesn't work template<typename T> union utype{ T v_; std::size_t sz_; };
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8754
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...
0
8630
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
7362
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
6181
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
5650
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
4177
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...
1
2760
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
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.