First  |  Prev |  Next  |  Last
Pages: 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
shift operator undefined behavior
Hi, I was expecting: int main( int argc, char *argv[] ) { unsigned char m = 32; register unsigned mask = (1<<m); std::cout << std::hex << mask << '\n'; return 0; } to print 0 but instead this program compiled with g++ prints 1! If I change (1<<m) by (1<<32) or if change the program for ... 14 Apr 2008 14:36
Does taking address of function template specialization not force instantiation?
Consider: #include <algorithm> #include <vector> template <typename Element, typename Member, Member (Element::*memPtr)()> bool lessMember(Element const& left, Element const& right) { return (left.*memPtr)() < (right.*memPtr)(); } ... 11 Apr 2008 13:29
anonymous enums and templates
Is this program valid? Why? If yes then what it prints? #include <iostream> #include <ostream> enum { value }; template <class T> int f(T) { return 1; } int f(int) { return 2; } int main() { std::cout << f(value) << std::endl; } Roman Perepelitsa. -- [ See http://www.gotw.ca/resourc... 13 Apr 2008 14:19
Lambda and Tuple question
Hi all, I'm having some difficulty in getting the following piece of code to compile: #include <iostream> #include <deque> #include <algorithm> #include <boost/tuple/tuple.hpp> #include <boost/lambda/lambda.hpp> int main(void) { typedef boost::tuples::tuple<unsigned int, double> my_tuple_type; ... 15 Apr 2008 13:56
virtualand nonvirtual templateness"
On Apr 11, 1:18 am, sasha <aborovin...(a)gmail.com> wrote: What are the rules governing virtual member of a template class, virtual template member of a template class and template member of non- template class? You cannot have a virtual function template in any kind of class or class template (because th... 12 Apr 2008 13:30
static const integral members
I have a question regarding the following snippet of code. struct foo { static const int value = 1; }; int main() { int bar = foo::value; } Is it valid C++? First of all, I'm sure that the following is valid: // foo is the same int main() { int bar[foo::value]; } And this one is not v... 13 Apr 2008 19:57
operator== on the unordered containers
Why is there no operator== defined for the unordered containers? Assuming a good hash function it is possible to define one for unordered_set and unordered_map that takes O(N) time (where N = the size of the collection): template <class X, class H, class P, class A> bool operator==(const unorderd_set<T, H, P... 18 Apr 2008 07:36
C++0X Its about (y)time
This is the proposed ytime. struct ytime { time_t tv_sec; unsigned long tv_nsec; }; This time representation would be used for both absolute and relative time, i.e. all time delays and would be returned by all standard-conforming clocks. This time representation would be used as an argument for sleep() and f... 16 Apr 2008 13:13
boost::graph problem
Hello, everyone! I am using boost::graph to deal with complex networks. One of the job is to read a dot file, while the simplest way is to use <boost/graph/graphviz.hpp>, read_graphviz(). I used following instruments: read_graphviz("karate.dot",ams); which is depreciated, but still usable. The problem is I ... 10 Apr 2008 16:55
FRUCTOSE unit test framework status change and article correction
A while ago I released a small, simple cutdown C++ unit test framework called FRUCTOSE (http://sourceforge.net/projects/fructose). I am now considering changing its status to stable and am asking for any comments, enhancement requests etc before I do that. Please post them to the sourceforge forum. You can post the... 10 Apr 2008 16:55
First  |  Prev |  Next  |  Last
Pages: 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33