jazzbearz / cpp-btree

Automatically exported from code.google.com/p/cpp-btree
Apache License 2.0
0 stars 0 forks source link

COMPILE_ASSERT problem #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile using MSVC 2010

What is the expected output? What do you see instead?

Compilation should succeed.

What version of the product are you using? On what operating system?

Windows 7 + MSVC 2010 (SP1)

Please provide any additional information below.

Compile error:

btree.h(1401) : error C2064: term does not evaluate to a function taking 2 
arguments

That is the 

COMPILE_ASSERT(
      sizeof(key_compare_checker(key_compare_helper()(key_type(), key_type()))) ==
      sizeof(big_),
      key_comparison_function_must_return_bool);

Original issue reported on code.google.com by christop...@gmail.com on 4 Feb 2013 at 2:18

GoogleCodeExporter commented 9 years ago
I have the same in Visual Studio 2012 Update 1.

Original comment by felipe.a...@gmail.com on 8 Feb 2013 at 1:21

GoogleCodeExporter commented 9 years ago
Obs.: I was using the source code v1.0.1

Original comment by felipe.a...@gmail.com on 8 Feb 2013 at 1:24

GoogleCodeExporter commented 9 years ago
OK, I'm re-installing my Windows machine at the moment. Please keep me posted, 
I'll catch up with you eventually.

Original comment by josh.mac...@gmail.com on 9 Feb 2013 at 7:21

GoogleCodeExporter commented 9 years ago

Original comment by josh.mac...@gmail.com on 9 Feb 2013 at 7:21

GoogleCodeExporter commented 9 years ago
Do not very understanding the code : 
staitc key_compare key_compare_helper() with its comment, is that OK ? cuz 
operator() does required an object setup, why not just init an object 
key_compare ?
// A never instantiated helper function that returns the key comparison
// functor.

if I use 'key_compare()' itself not this method, thus vs2012 won't report 
error. but that's may NOT the intent of the original wanna ...  maybe it would 
support n > 2 ??

Original comment by littlewa...@gmail.com on 14 Feb 2013 at 4:11

GoogleCodeExporter commented 9 years ago
I kept the code as close to the original as possible adding .operator() after 
key_compare_helper() , getting

COMPILE_ASSERT(
      sizeof(key_compare_checker(key_compare_helper().operator()(key_type(), key_type()))) ==
      sizeof(big_),
      key_comparison_function_must_return_bool);

Original comment by davidepa...@gmail.com on 4 Aug 2013 at 8:50