std::vector<int[2]> intializing trouble 
Author Message
 std::vector<int[2]> intializing trouble

I am trying to create a vector containing simple fixed
sized base type arrays.  I want to create an initial
element in the vector that will be filled later.  I do
not have a concrete base object to construct from (or
else I would simply call vector::push_back).

I thought I could use vector::resize or vector::push_back
as follows, but no luck.

Can anyone explain why the second example does not work?

This works:
   std::vector<int> test;
   test.resize(1);
     or
   test.push_back(std::vector<int>::value_type());

This does not work.
   std::vector<int[2]> test;
   test.resize(1);
     or
   test.push_back(std::vector<int[2]>::value_type());

Thanks for any input.
John



Tue, 23 Aug 2005 00:33:14 GMT  
 std::vector<int[2]> intializing trouble
You can't do that - C arrays are not assignable. In other words, this
doesn't work:

int a[2];
int b[2];
b = a; // doesn't compile
int c[2] = a; // doesn't compile

Consider using vector<pair<int, int> >
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> I am trying to create a vector containing simple fixed
> sized base type arrays.  I want to create an initial
> element in the vector that will be filled later.  I do
> not have a concrete base object to construct from (or
> else I would simply call vector::push_back).

> I thought I could use vector::resize or vector::push_back
> as follows, but no luck.

> Can anyone explain why the second example does not work?

> This works:
>    std::vector<int> test;
>    test.resize(1);
>      or
>    test.push_back(std::vector<int>::value_type());

> This does not work.
>    std::vector<int[2]> test;
>    test.resize(1);
>      or
>    test.push_back(std::vector<int[2]>::value_type());

> Thanks for any input.
> John



Tue, 23 Aug 2005 01:22:16 GMT  
 std::vector<int[2]> intializing trouble
vector<pair<int, int> > won't work as I have a C array that is 928 elements.
I only used [2] as a simple example.


Quote:
> You can't do that - C arrays are not assignable. In other words, this
> doesn't work:

> int a[2];
> int b[2];
> b = a; // doesn't compile
> int c[2] = a; // doesn't compile

> Consider using vector<pair<int, int> >
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > I am trying to create a vector containing simple fixed
> > sized base type arrays.  I want to create an initial
> > element in the vector that will be filled later.  I do
> > not have a concrete base object to construct from (or
> > else I would simply call vector::push_back).

> > I thought I could use vector::resize or vector::push_back
> > as follows, but no luck.

> > Can anyone explain why the second example does not work?

> > This works:
> >    std::vector<int> test;
> >    test.resize(1);
> >      or
> >    test.push_back(std::vector<int>::value_type());

> > This does not work.
> >    std::vector<int[2]> test;
> >    test.resize(1);
> >      or
> >    test.push_back(std::vector<int[2]>::value_type());

> > Thanks for any input.
> > John



Tue, 23 Aug 2005 01:33:21 GMT  
 std::vector<int[2]> intializing trouble

Quote:
> vector<pair<int, int> > won't work as I have a C array that is 928
elements.
> I only used [2] as a simple example.

vector<vector<int> > is probably your best choice then.

Ken



Tue, 23 Aug 2005 01:46:42 GMT  
 std::vector<int[2]> intializing trouble
what's wrong with

vector< pair< pair< pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair< pair<pair< pair<pair< pair<?

maybe you could simplify it with recursive macros!

=]

charles nicholson


Quote:


> > vector<pair<int, int> > won't work as I have a C array that is 928
> elements.
> > I only used [2] as a simple example.

> vector<vector<int> > is probably your best choice then.

> Ken



Tue, 23 Aug 2005 03:41:45 GMT  
 std::vector<int[2]> intializing trouble
How would you access a k-th element of such a tuple, with k determined
at run-time?
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> what's wrong with

> vector< pair< pair< pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> pair<pair< pair<pair< pair<pair< pair<?

> maybe you could simplify it with recursive macros!

> =]

> charles nicholson





> > > vector<pair<int, int> > won't work as I have a C array that is 928
> > elements.
> > > I only used [2] as a simple example.

> > vector<vector<int> > is probably your best choice then.

> > Ken



Tue, 23 Aug 2005 03:50:48 GMT  
 std::vector<int[2]> intializing trouble
Why, with more macros, of course!
(it was a joke, btw)

charles nicholson


Quote:
> How would you access a k-th element of such a tuple, with k determined
> at run-time?
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > what's wrong with

> > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<?

> > maybe you could simplify it with recursive macros!

> > =]

> > charles nicholson





> > > > vector<pair<int, int> > won't work as I have a C array that is 928
> > > elements.
> > > > I only used [2] as a simple example.

> > > vector<vector<int> > is probably your best choice then.

> > > Ken



Tue, 23 Aug 2005 03:57:11 GMT  
 std::vector<int[2]> intializing trouble
Probably something along the lines of (after changing the format from
pair<pair<>,int> to pair<int,pair<> >):

template <typename tuple>
int& access_element(tuple& t, int n) {
  if (n == 0) return t.first; else return access_element(t.second,n-1);

Quote:
}

template <>
int& access_element(int& t, int n) {
  if (n != 0) throw std::exception("accessing beyond the end of the
tuple");
  return t;

Quote:
}

pair<int,pair<int,pair<int,int> > > tuple;
for (int i=0;i<4;++i) access_element(tuple,i) = 2*i;
for (int i=0;i<4;++i) std::cerr << access_element(tuple,i) << std::endl;

Not that I recommend such a thing :)

Ken


Quote:
> How would you access a k-th element of such a tuple, with k determined
> at run-time?
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > what's wrong with

> > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > pair<pair< pair<pair< pair<pair< pair<?

> > maybe you could simplify it with recursive macros!

> > =]

> > charles nicholson





> > > > vector<pair<int, int> > won't work as I have a C array that is
928
> > > elements.
> > > > I only used [2] as a simple example.

> > > vector<vector<int> > is probably your best choice then.

> > > Ken



Tue, 23 Aug 2005 04:04:24 GMT  
 std::vector<int[2]> intializing trouble
That would work, though it makes accessing n-th element an operation of
O(n) complexity instead of O(1). Also, recursive functions typically
don't get inlined, so it's going to be slow and bloated.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Probably something along the lines of (after changing the format from
> pair<pair<>,int> to pair<int,pair<> >):

> template <typename tuple>
> int& access_element(tuple& t, int n) {
>   if (n == 0) return t.first; else return

access_element(t.second,n-1);
Quote:
> }

> template <>
> int& access_element(int& t, int n) {
>   if (n != 0) throw std::exception("accessing beyond the end of the
> tuple");
>   return t;
> }

> pair<int,pair<int,pair<int,int> > > tuple;
> for (int i=0;i<4;++i) access_element(tuple,i) = 2*i;
> for (int i=0;i<4;++i) std::cerr << access_element(tuple,i) <<
std::endl;

> Not that I recommend such a thing :)

> Ken



> > How would you access a k-th element of such a tuple, with k
determined
> > at run-time?
> > --
> > With best wishes,
> >     Igor Tandetnik

> > "For every complex problem, there is a solution that is simple,
neat,
> > and wrong." H.L. Mencken



> > > what's wrong with

> > > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > pair<pair< pair<pair< pair<pair< pair<?

> > > maybe you could simplify it with recursive macros!

> > > =]

> > > charles nicholson





> > > > > vector<pair<int, int> > won't work as I have a C array that is
> 928
> > > > elements.
> > > > > I only used [2] as a simple example.

> > > > vector<vector<int> > is probably your best choice then.

> > > > Ken



Tue, 23 Aug 2005 04:11:37 GMT  
 std::vector<int[2]> intializing trouble
Actually, it's not technically recursive, since each call is to a
different instance of the function.  It will create N functions, where N
is the size of your tuple, but I wouldn't be surprised if the compiler
was able to completely inline the access.  (I wouldn't be surprised if
it didn't, either.)

Ken


Quote:
> That would work, though it makes accessing n-th element an operation
of
> O(n) complexity instead of O(1). Also, recursive functions typically
> don't get inlined, so it's going to be slow and bloated.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > Probably something along the lines of (after changing the format
from
> > pair<pair<>,int> to pair<int,pair<> >):

> > template <typename tuple>
> > int& access_element(tuple& t, int n) {
> >   if (n == 0) return t.first; else return
> access_element(t.second,n-1);
> > }

> > template <>
> > int& access_element(int& t, int n) {
> >   if (n != 0) throw std::exception("accessing beyond the end of the
> > tuple");
> >   return t;
> > }

> > pair<int,pair<int,pair<int,int> > > tuple;
> > for (int i=0;i<4;++i) access_element(tuple,i) = 2*i;
> > for (int i=0;i<4;++i) std::cerr << access_element(tuple,i) <<
> std::endl;

> > Not that I recommend such a thing :)

> > Ken



> > > How would you access a k-th element of such a tuple, with k
> determined
> > > at run-time?
> > > --
> > > With best wishes,
> > >     Igor Tandetnik

> > > "For every complex problem, there is a solution that is simple,
> neat,
> > > and wrong." H.L. Mencken



> > > > what's wrong with

> > > > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
pair<pair<
> > > pair<pair<
> > > > pair<pair< pair<pair< pair<pair< pair<?

> > > > maybe you could simplify it with recursive macros!

> > > > =]

> > > > charles nicholson





> > > > > > vector<pair<int, int> > won't work as I have a C array that
is
> > 928
> > > > > elements.
> > > > > > I only used [2] as a simple example.

> > > > > vector<vector<int> > is probably your best choice then.

> > > > > Ken



Tue, 23 Aug 2005 04:16:51 GMT  
 std::vector<int[2]> intializing trouble
Err...that can't work with a runtime value though.  Right.

Empirical testing shows that the element is accessed directly when the
index is a constant integer and the function is inlined.

Taking a dynamic index does take O(N) time, but the entire process is
inlined (at least at a size 6 tuple).

Ken


Quote:
> Actually, it's not technically recursive, since each call is to a
> different instance of the function.  It will create N functions, where
N
> is the size of your tuple, but I wouldn't be surprised if the compiler
> was able to completely inline the access.  (I wouldn't be surprised if
> it didn't, either.)

> Ken



> > That would work, though it makes accessing n-th element an operation
> of
> > O(n) complexity instead of O(1). Also, recursive functions typically
> > don't get inlined, so it's going to be slow and bloated.
> > --
> > With best wishes,
> >     Igor Tandetnik

> > "For every complex problem, there is a solution that is simple,
neat,
> > and wrong." H.L. Mencken



> > > Probably something along the lines of (after changing the format
> from
> > > pair<pair<>,int> to pair<int,pair<> >):

> > > template <typename tuple>
> > > int& access_element(tuple& t, int n) {
> > >   if (n == 0) return t.first; else return
> > access_element(t.second,n-1);
> > > }

> > > template <>
> > > int& access_element(int& t, int n) {
> > >   if (n != 0) throw std::exception("accessing beyond the end of
the
> > > tuple");
> > >   return t;
> > > }

> > > pair<int,pair<int,pair<int,int> > > tuple;
> > > for (int i=0;i<4;++i) access_element(tuple,i) = 2*i;
> > > for (int i=0;i<4;++i) std::cerr << access_element(tuple,i) <<
> > std::endl;

> > > Not that I recommend such a thing :)

> > > Ken



> > > > How would you access a k-th element of such a tuple, with k
> > determined
> > > > at run-time?
> > > > --
> > > > With best wishes,
> > > >     Igor Tandetnik

> > > > "For every complex problem, there is a solution that is simple,
> > neat,
> > > > and wrong." H.L. Mencken



> > > > > what's wrong with

> > > > > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair<
> > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> pair<pair<
> > > > pair<pair<
> > > > > pair<pair< pair<pair< pair<pair< pair<?

> > > > > maybe you could simplify it with recursive macros!

> > > > > =]

> > > > > charles nicholson





> > > > > > > vector<pair<int, int> > won't work as I have a C array
that
> is
> > > 928
> > > > > > elements.
> > > > > > > I only used [2] as a simple example.

> > > > > > vector<vector<int> > is probably your best choice then.

> > > > > > Ken



Tue, 23 Aug 2005 04:39:14 GMT  
 std::vector<int[2]> intializing trouble

Quote:
> That would work, though it makes accessing n-th element an operation
of
> O(n) complexity instead of O(1). Also, recursive functions typically
> don't get inlined, so it's going to be slow and bloated.

Of course, you can get O(lg(n)) performance out of a pair<pair<>,pair<>

Quote:
> structure.

template <typename tuple>
inline int size(const tuple& t) {
  return size(t.first)+size(t.second);

Quote:
}

template <>
inline int size(const int& t) {
  return 1;

Quote:
}

template <typename tuple>
inline int& get(tuple& t, int i) {
  if (i < size(t.first)) return get(t.first,i); else return
get(t.second,i-size(t.first));

Quote:
}

template <>
inline int& get(int& t, int i) {
  return t;

Quote:
}

pair<pair<pair<int,int>,pair<int,int> >,pair<pair<int,int>,pair<int,int>
Quote:
> > tuple;

for (int i=0;i<8;++i) get(tuple,i) = 2*i;
for (int i=0;i<8;++i) std::cerr << get(tuple,i) << std::endl;

Again, not that I recommend any of this hackery :)

Ok, back to productive work with me.

Ken



Tue, 23 Aug 2005 04:55:48 GMT  
 std::vector<int[2]> intializing trouble

Quote:
> Err...that can't work with a runtime value though.  Right.

Right, until you make a lisp-ish cascading macro like Loki's type-list
creators that will access the Nth element of any composed pair construct...
too gross to think about....

charles nicholson

Quote:
> Empirical testing shows that the element is accessed directly when the
> index is a constant integer and the function is inlined.

> Taking a dynamic index does take O(N) time, but the entire process is
> inlined (at least at a size 6 tuple).

> Ken



> > Actually, it's not technically recursive, since each call is to a
> > different instance of the function.  It will create N functions, where
> N
> > is the size of your tuple, but I wouldn't be surprised if the compiler
> > was able to completely inline the access.  (I wouldn't be surprised if
> > it didn't, either.)

> > Ken



> > > That would work, though it makes accessing n-th element an operation
> > of
> > > O(n) complexity instead of O(1). Also, recursive functions typically
> > > don't get inlined, so it's going to be slow and bloated.
> > > --
> > > With best wishes,
> > >     Igor Tandetnik

> > > "For every complex problem, there is a solution that is simple,
> neat,
> > > and wrong." H.L. Mencken



> > > > Probably something along the lines of (after changing the format
> > from
> > > > pair<pair<>,int> to pair<int,pair<> >):

> > > > template <typename tuple>
> > > > int& access_element(tuple& t, int n) {
> > > >   if (n == 0) return t.first; else return
> > > access_element(t.second,n-1);
> > > > }

> > > > template <>
> > > > int& access_element(int& t, int n) {
> > > >   if (n != 0) throw std::exception("accessing beyond the end of
> the
> > > > tuple");
> > > >   return t;
> > > > }

> > > > pair<int,pair<int,pair<int,int> > > tuple;
> > > > for (int i=0;i<4;++i) access_element(tuple,i) = 2*i;
> > > > for (int i=0;i<4;++i) std::cerr << access_element(tuple,i) <<
> > > std::endl;

> > > > Not that I recommend such a thing :)

> > > > Ken



> > > > > How would you access a k-th element of such a tuple, with k
> > > determined
> > > > > at run-time?
> > > > > --
> > > > > With best wishes,
> > > > >     Igor Tandetnik

> > > > > "For every complex problem, there is a solution that is simple,
> > > neat,
> > > > > and wrong." H.L. Mencken



> > > > > > what's wrong with

> > > > > > vector< pair< pair< pair< pair<pair< pair<pair< pair<pair<
> > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<pair< pair<pair<
> > pair<pair<
> > > > > pair<pair<
> > > > > > pair<pair< pair<pair< pair<pair< pair<?

> > > > > > maybe you could simplify it with recursive macros!

> > > > > > =]

> > > > > > charles nicholson





> > > > > > > > vector<pair<int, int> > won't work as I have a C array
> that
> > is
> > > > 928
> > > > > > > elements.
> > > > > > > > I only used [2] as a simple example.

> > > > > > > vector<vector<int> > is probably your best choice then.

> > > > > > > Ken



Tue, 23 Aug 2005 05:18:14 GMT  
 std::vector<int[2]> intializing trouble

Quote:


> > Err...that can't work with a runtime value though.  Right.

> Right, until you make a lisp-ish cascading macro like Loki's type-list
> creators that will access the Nth element of any composed pair
construct...
> too gross to think about....

Actually, that's more or less what I did.  I meant it can't work in
constant time with a runtime index.

It works just fine with a runtime index in linear time.  Or a compile
time index in constant time.  I imagine Loki's access speed is similar.

Ken



Tue, 23 Aug 2005 05:30:19 GMT  
 std::vector<int[2]> intializing trouble

Quote:
> It works just fine with a runtime index in linear time.  Or a compile
> time index in constant time.  I imagine Loki's access speed is

similar.

Loki works on lists of types, not on lists of values. Type manipulation
is always done compile-time. So, it makes compile time linear or worse,
but no run-time code is actually generated.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Tue, 23 Aug 2005 05:48:37 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Warnings for std::vector<std::string>

2. typedef std::vector<std::string> Vector_String

3. std::vector<user-defined class>

4. std::vector<CClass*> / destructors

5. vector<std::string>

6. <<<<<<<Parsing help, please>>>>>>>>

7. BUG?: vector <int,allocator<int>> compiler whitespace error [newbie BEGS your help!]

8. BUG?: vector <int,allocator<int>> compiler whitespace error [newbie BEGS your help!]

9. File Format conversion, ascii freeform -->.csv <-->.wk1<-->dbf<-->?HELP

10. std::vector<int>> why no error

11. <<<>>>Need C code advice with functions and sorting.<<<>>>

12. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

 

 
Powered by phpBB® Forum Software