Jon Stewart on 14 Oct 2003 15:01:09 -0000 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [ALACPP] where the boost meets the stl |
> > Yeah, I went to sleep thinking the only hook would be "operator int", > > but I thought that couldn't possibly be what you meant. ;-) It's cool, though, because it comes with the realization that one can use type conversion to let an object know when it's being used as an rvalue and take appropriate action, thus enabling a form of lazy evaluation. > FYI, there is an even more evil way to do it that I also thought about: > > Create a wrapper iterator and dereferenced type that did all the > evilness in operator()=(x). See, I can top your evil foo! so... like this? fill_n(MakeEvilIterator(back_inserter(vec)), 20, var(i)++); // EvilIterator overloads operator()=(x) to take the lambda function // and assign the result of a call to the back_inserter. One issue, I'm not sure it's a problem, is that you sort of have the evil iterator and the lambda function meeting in the middle, so to speak. For lack of vocabulary, they "converge". (If Flannery O'Connor had been a l33t C++ h8x0r, she'd write code like this.) Jon -- Jon Stewart Advanced Los Angeles C++ stew1@xxxxxxxxxxx http://www.alacpp.org _______________________________________________ alacpp mailing list alacpp@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/alacpp