473,385 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

implementing a templated struct within a templated struct

hi all,
Basically I have the following situation in my header-file:

---
....

template <typename ta_type>
struct A
{
template<size_t ta_size>
struct B
{
inline void do_something_big();
};
};

#include "A.inl"

....
---
The function do_something_big contains quite a lot of code and for obvious
keeping it clean reasons I want to implement this function in the .inl file.

My question is, how would I do this. First of all I'm thinking I will get
stuck with the

A::B::do_something_big

definition, but next to this I have two template definitions to make before
I can even start with typing this !

Is this at all possible ?

kind regards,
richard
Jul 22 '05 #1
3 1187
template <typename T>

template <size_t size>

void A<T>::B<size>::do_something_big()
Jul 22 '05 #2
RA Scheltema wrote:
hi all,
Basically I have the following situation in my header-file:

---
...

template <typename ta_type>
struct A
{
template<size_t ta_size>
struct B
{
inline void do_something_big();
};
};

#include "A.inl"

...
---
The function do_something_big contains quite a lot of code and for obvious
keeping it clean reasons I want to implement this function in the .inl file.

My question is, how would I do this. First of all I'm thinking I will get
stuck with the

A::B::do_something_big

definition, but next to this I have two template definitions to make before
I can even start with typing this !

Is this at all possible ?

kind regards,
richard


If you know it's "big," why are you declaring it inline?

Anyway, it's worse than A::B::do_something_big( ). Try this:

template< typename ta_type >
template< size_t ta_size >
void A<ta_type>::B<ta_size>::do_something_big( )
{
// ...
}

Jul 22 '05 #3
hi there,

been reading some visual c++ docs (the compiler of my choice :( ...) and
just found out that this construction isn't possible there. stupid of me to
expect that visual c++ could do something useful :). anyway, the largeness
of the code is of course relative. I just thought it cleaner to put it in
some outside implementation as not to clutter up my header, but alas
thanks for the reactions
richard
"RA Scheltema" <r.a.scheltema[viral][s][p]@[m]dacolian.nl> schreef in
bericht news:3f*********************@news.xs4all.nl...
hi all,
Basically I have the following situation in my header-file:

---
...

template <typename ta_type>
struct A
{
template<size_t ta_size>
struct B
{
inline void do_something_big();
};
};

#include "A.inl"

...
---
The function do_something_big contains quite a lot of code and for obvious
keeping it clean reasons I want to implement this function in the .inl file.
My question is, how would I do this. First of all I'm thinking I will get
stuck with the

A::B::do_something_big

definition, but next to this I have two template definitions to make before I can even start with typing this !

Is this at all possible ?

kind regards,
richard

Jul 22 '05 #4

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

Similar topics

2
by: Thomas Matthews | last post by:
Hi, I would like to create a table (or vector) of pointers to templated functions. 1. How do I declare a typedef of a pointer to a templated function? For example, I have some functions...
4
by: __PPS__ | last post by:
suppose I have class that has templated operator. I want to have a few overloads/template specializations for different types. Basicly, the biggest problem I have is to be able to have this: ...
2
by: Alex Drummond | last post by:
Hello, Is there any way of specializing a templated function on a type which is itself templated? Here's the simplest example of the problem I can think of. Say I have written an implementation...
4
by: Toby | last post by:
Hail and well met. I am trying to pass a templated struct to another template. Ex: template <class VertexType> struct EdgeNode { VertexType index; int weight; };
2
by: Pete C | last post by:
Hello... I am writing a templated 'wrapper' class that takes as its template parameter a class to be inherited from. I need a specialisation of this wrapper class in certain cases, however I am...
15
by: kwikius | last post by:
Hi all, I have been searching through the list of papers at: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/ I seem to remember a proposal regarding templated namespaces e.g: template...
6
by: Raj Wall | last post by:
Hi, I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary. My struct declaration has: public struct Ring : IEqualityComparer {...
2
card
by: card | last post by:
Hi everyone, I have a question about referencing a nested class contained within a templated class. Of course the best way to show you is by example. Here's my templated classes: #include...
3
card
by: card | last post by:
Ah, the joy of generic programming. Ok. Here's my problem. I have a templated class with a internally defined structure type. Within the class, I have some member functions whose return value is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.